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).
How do find your PHP error log on Linux:
Another equivalent way:
Linux
The terminal will output the error log location.
Windows
The command prompt will output the error log location
To set the log location
Open your
php.ini
and add the following line:Thanks @chelmertez, @Boom for these (comments on the question).
If You use php5-fpm log default should be under
It can also be
/var/log/apache2/error.log
if you are in google compute engine.And you can view tail like this:
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:
locate php.ini
.Search these files for the
error_reporting
value;Which should be set to whatever amalgamation of php log levels are enough for you.,
Eg:
E_ALL & ~E_DEPRECATED & ~E_STRICT
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/
.