8

Failed to open stream: Too many open files

view full story
linux-howto

http://stackoverflow.com – I'm writing a PHP CLI script for a client that runs in a shared hosting. It logs to a file using a simple function like: function log_entry($msg) { global $log_file, $log_handle; $msg = "[".date('Y-m-d H:i:s')."] ".$msg."\n"; echo $msg; $log_handle = fopen($log_file, 'a'); fwrite($log_handle, $msg); } And I get this error: PHP Warning: fopen(./logs/sync.20130410.log) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Too many open files in ./functions.php on line 61 I thought there was an issue with using the same handle, so I change (HowTos)