I am running a VPS server with cPanel on it. I have set up all Apache server errors to log to /usr/local/apache/logs/error_log.
Is possible to log error message to Apache error log, instead of user PHP related error_log in /home/user/public_html/error_log.log
I have this snippet for testing, but everything I get is my custom error_log message logged in error_log file inside my public_html/ instead in Apache error_log.
<?php
/**
*
* Logs a message to Apache server error_log at /usr/local/apache/logs/error_log
*
*
*/
error_log("Just a ordinary Apache error_log for testing", 0, "/usr/local/apache/logs/error_log.log") // logs to user error_log in public_html/
Is this even possible?
Use apache .htaccess
file in your web root for logging all the errors and warnings.
Inside .htaccess
file:
php_flag log_errors on
php_value error_log /usr/local/apache/logs/error_log.log
In this way you don't have to write codes for every error occurrence. Appache will log all the errors and warnings automatically to your specified error log file.
Hope this helps.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments