Use the following code:
ini_set("log_errors", 1); ini_set("error_log", "/tmp/php-error.log"); error_log( "Hello, errors!" );
Then watch the file:
tail -f /tmp/php-error.log
Also:
– ini_set does only work if that code is executed. Not useful for code that has parse errors because the error will be before the code is executed. Instead write those changes into the php.ini.
– If you can’t edit php.ini, you should be able to add this in the .htaccess : php_flag log_errors on php_value error_log /home/path/public_html/domain/PHP_errors.log.
– Take a look at the log_errors configuration option in php.ini. Please not that display_errors should be disabled in php.ini if this option is enabled.