It depends on which ini file you're using and the settings it has.
If you're following the example from the function hook page, then your shebang line is
which means we can get the ini file location with
Code:
/usr/bin/php-cgi -i |grep --colour 'php.ini'
<tr><td class="e">error_reporting</td><td class="v">6135</td><td class="v">6135</td></tr>
Now we know which ini file to look at, /usr/local/lib/php.ini
What we want to know is
1) what/where the error log is defined to be
2) if errors are redirected to the STDOUT
3) if error reporting is enabled
4) and if errors are even logged
Code:
awk '/(^error_log[[:space:]]?=)|(^display_errors[[:space:]]?=)|(^error_reporting[[:space:]]?=)|(^log_errors[[:space:]]?=)/{print $0};' /usr/local/lib/php.ini
For my box, I got
Code:
display_errors = On
log_errors = On
error_log = /usr/local/cpanel/logs/error_log
but your's is likely to be different. But lets quickly analyze my results.
1) display_errors is "on". This means that any error message that would normally be sent to an error log will also be sent to STDOUT. This is not something that most people want in a production environment. In the case of function hooks this would not be a good setting since the output is trapped by the invoking cPanel process and will break the cPanel response (if any errors were to occur). Function hooks should never produce anything to STDOUT
- You can modify this in your script with
PHP Code:
ini_set('display_errors', 0);
- Or better, change the setting in the ini
- See display_errors in the PHP manual
2) log_errors is on, meaning that any errors will be send to the "error_log" location.
- See log_errors
3) my error_log setting is the standard cPanel error log. This is something that I personally set on my box because it's a convenient place. I think the current default for this value on a cPanel installation is simply "error_log", which is Apache's error log, /usr/local/apache/logs/error_log
PHP Code:
ini_set('error_log', '/some/place');
- See error_log
4) Since nothing was returned for error_reporting, the default is applied, "6135" or "E_ALL & ~E_NOTICE"
- we can confirm this with a grep on the info output
Code:
/usr/bin/php-cgi -i |grep --colour error_reporting
- See error_reporting
Hope this helps get you going in the right direction.
Regards,
-DavidN