Where does PHP store the error log? (php5, apache, fastcgi, cpanel)
I am on shared hosting and have Cpanel, Apache, PHP is run by fastcgi. Where does PHP store the error log?
Is there any other way I can find the error log on shared hosting environment instead of having to go through entire site structure to look for error_log files?
I have access to the
php.ini (I am using PHP version 5.2.16).
PHP stores error logs in
/var/log/apache2 if PHP is an apache2 module.
Shared hosts are often storing log files in your root directory
But...if you have access to a
php.ini file you can do this:
error_log = /var/log/php-scripts.log
According to rinogo's comment: If you're using cPanel, the master log file you're probably looking for is stored (by default) at
If all else fails you can check the location of the log file using
<?php phpinfo(); ?>
Read more… Read less…
phpinfo() and check for "error_log"
php --info | grep error
The terminal will output the error log location.
php --info | findstr /r /c:"error_log"
The command prompt will output the error log location
To set the log location
php.ini and add the following line:
error_log = /log/myCustomLog.log
On a LAMP environment the php errors are default directed to this below file.
All access logs come under:
How do find your PHP error log on Linux:
[email protected] /var $ sudo updatedb [sudo] password for eric: [email protected] /var $ sudo locate error_log /var/log/httpd/error_log
Another equivalent way:
[email protected] /home/eric $ sudo find / -name "error_log" 2>/dev/null /var/log/httpd/error_log
It appears that by default php does not log errors anywhere, the
error_log key in php.ini is commented out in all the install's I've seen.
- look for php.ini files.
Search these files for the
Which should be set to whatever amalgamation of php log levels are enough for you.,
E_ALL & ~E_DEPRECATED & ~E_STRICT
error_logvalue to make sure it points to an actual place and is not commented out.
The default value doesn't give a full path, only a file name, I don't know where this path resolves to normally. Probably