ini_set('error_log', $custom_error_log_location);
print ini_get('error_log');
The result of the above code? Nothing! It literally prints nothing as the value of ini_get('error_log'). I'm running this on an Apache server. I investigated the Apache configuration for my website. The Apache configuration has its own error log setup through the ErrorLog directive. Here's the thing: I'm running another website on the same server, with a similar Apache configuration, and on that site I CAN specify a custom error log in PHP.
I also checked the site's php.ini file. Nothing on logging there. What I want to know is, is there some configuration in either Apache or php.ini that would prevent me from modifying where the error log file is located?
If
safe_modeoropen_basedirare in effect,ini_set("error_log")is restricted by those settings (because you can write anything in the opened file witherror_log()).The restriction covers both runtime and
.htaccess, but you can use thephp_valuedirective to set it in the virtual host configuration file.