I just adjusted the php.ini on my CentOS 64 Bits VPS in /etc/php.ini to log PHP errors:
cat /etc/php.ini | grep php-errors.log
error_log = /var/log/php-errors.log
I also have log_errors = on
I created the log file in /var/log/ and it is CHMOD 644. I also turned on Error reporting E_ALL
cat /etc/php.ini | grep error_reporting
; error_reporting
error_reporting = E_ALL
; Eval the expression with current error_reporting(). Set to true if you want
; error_reporting(0) around the eval().
Then I restarted the httpd daemon. When I add a file via the WordPress uploader I see it is not uploaded because of a permission issue
“cannot-open-file.png” has failed to upload due to an error
Unable to create directory wp-content/uploads/2014/05. Is its parent directory writable by the server?
, but it is not stored as an error in php-errors.php:
pwd
/var/log
ls -l | grep php
-rw-r--r-- 1 root root 0 May 6 06:21 php-errors.log
All my other logs in /var/log/httpd
are also root:root
so I would assume the logging would work. And when I did adjust the file's permissions to apache:apache
as suggested I still had no errors in the log file. Even adding error logging on to the .htaccess did not help.
I also checked the PHP.ini using phpinfo()
. The only ini loaded is the one I adjusted in /etc/php.ini
and the user and group it is using is apache - User/Group apache(48)/48
. What am I missing?
PS Could be issues with the directory for the log files as suggested here Can't configure PHP error log I am checking out more info on this.
Answer
Apparently I also needed display_errors = on
. I thought this was for error display onscreen but it is for error logging as well it seems.
No comments:
Post a Comment