PHP error log in same directory as script
How can I let PHP create an error_log file in the same directory as the script that throws the error?
I am running CGI php handler. Current ini setting error_log value is error_log. (error_log = error_log)
-
Hello @rappie, This should happen by default if you are using CGI as the PHP handler. Can you browse to WHM >> MultiPHP Manager and confirm if PHP-FPM is enabled for the domain you are testing with? Thank you. 0 -
@cPanelMichael thank you. I always thought having the error_log file in the same directory as the script that throws error was default behavior when using CGI as the PHP handler as well. However this doesn't seem to the case on my install. The PHP-FPM option is turned off for all domains. 0 -
Hi @cPanelMichael Thank you. I think I have managend to narrow it down to the MPM. Only when the prefork MPM is used a error_log file is created in the same directory as the script that throws the error. Is this right? Or should this also work when any of the other MPM's are used? 0 -
Hello @rappie, Upon testing with the Worker and Event MPMs, I can confirm you are correct. The Prefork MPM is required for direct logging to the individual PHP error_log file under the website's document root directory. With the Worker and Event MPMs, the PHP errors are logged directly to the Apache error log (/usr/local/apache/logs/error_log). You can read more about each MPM at: Multi-Processing Modules - MPMs - EasyApache 4 - cPanel Documentation Thank you. 0
Please sign in to leave a comment.
Comments
5 comments