Seems like I can't get error logging working on my server, I've set up my vhosts like in this description like suggested here .
<VirtualHost *:80>
ServerAdmin admin@server.com
DocumentRoot /var/www/html
ServerName www.server.com
ServerAlias server.com
LogFormat combined
ErrorLog /var/log/apache2/server.com-error_log
TransferLog /var/log/apache2/server.com-access_log
php_flag log_errors on
php_flag display_errors off
php_value error_reporting 6143
php_value error_log /var/log/apache2/server.com-php-error.log
...
</VirtualHost>
access and error log are written correctly, the php error log file is created and has the same permission as the other two log files.
I also tried to set the logging in the php.ini, .htaccess file and in the script, all according to this guide .
php -v
PHP 5.2.10-2ubuntu6.10 with Suhosin-Patch 0.9.7 (cli) (built: May 2 2011 23:24:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
Are there any other places I could check? The vHost configuration worked flawlessly on other servers.
Probably it's due to permissions on /var/log/apache2
. Take into account that PHP is running as an apache module, so it is running as the www-data
user (in ubuntu at least). So you need that this user has at least execute permission on /var/log/apache2
and write permission on the log files, or better yet, execute and write permission on /var/log/apache2
(to be able to create new log files if needed).
So you can save the php log to another folder, or make it writable by the www-data
user (in the latter case, you may also edit the /etc/logrotate.d/apache2
file so new logfiles after rotation get owned by the www-data
user.
Type into your php script:
error_reporting(E_ALL);
ini_set('display_errors', true);
Than you get your errors and warnings printed
尝试PHP日志的默认位置:/var/log/php.log
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.