douyou7797 2012-09-24 13:32
浏览 73

没有php错误登录apache

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.

  • 写回答

3条回答 默认 最新

  • douzhe3516 2012-09-24 14:17
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集