Where are the PHP error logs stored on a Debian 8 "Jessie" server?
The problem is that there are multiple ways to run PHP scripts when they are accessed via a web server, and logging depends on that. To rephrase, whatever runs PHP, maintains the logging.
On my Jessie (Debian 8) systems I run PHP using php5-fpm
and it has logging configured in /etc/php5/fpm/php-fpm.conf
(but that can be overridden for each so-called "pool" php-fpm
uses).
On older systems it was customary to run PHP using mod_fcgid
, and in that case the php5-cgi
binary is used to actually run the scripts, and it reads its configuration from /etc/php5/cgi/php.ini
.
Some folks still use mod_php
to run PHP scripts, and in this case something like /etc/php5/apache2/php.ini
is used by that module.
To round up, the configuration depends on the way you serve calls to PHP scripts, so figure that out first, and then work from there.
A hint: if you do have PHP minimally working, create a simple site which serves a single script reading
<?php
phpinfo();
access that script and see what PHP engine prints about its configuration — including places it acquired this configuration from.
Related videos on Youtube
Michael
Interests: Android Development, Network/Software Security
Updated on September 18, 2022Comments
-
Michael over 1 year
I know this question has been asked many times before, and I've looked at all the answers but they don't seem to work for me. I am trying to check if the error log is turned on for PHP, so I went to the php.ini file and uncommented the line in the picture seen below.
I tried using the "whereis" command to find where php_error.log is but it returned a line that had "php_error: " and nothing else. Is that the correct way to view/turn on the php error logs? If not how do I and can I redirect them to an easier folder to access such as my home folder?
Also, I understand that there are many different types of errors, but do I need to configure all of their paths or do they automatically go to the same error log?
As a side note I have apache2 installed. I've seen a lot of questions relating php and apache2 and I'm not sure why so does the way to handle error logging?
Thanks