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).

8/24/2015 9:33:49 AM

Accepted Answer

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 /log subfolder. 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(); ?>
10/22/2019 12:52:39 PM

Try 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

Open your php.ini and add the following line:

error_log = /log/myCustomLog.log

Thanks @chelmertez, @Boom for these (comments on the question).


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


Another equivalent way:

[email protected] /home/eric $ sudo find / -name "error_log" 2>/dev/null


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.

Generally I:

  1. look for php.ini files. locate php.ini.
  2. Search these files for the error_reporting value;

    Which should be set to whatever amalgamation of php log levels are enough for you.,


  3. Check the error_log value 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 /var/log/.