為什么我的php error_log()語句被發送到apache error.log?

[英]Why do my php error_log() statements get sent to the apache error.log?


What I've tried:

我嘗試過的:

php.ini

log_errors = On
error_log = /etc/httpd/logs/php_error.log 

httpd.conf

php_value error_log /etc/httpd/logs/php_error.log

I've tried these in different combinations, stopped and started httpd and verified that these settings are recognized in phpinfo(), but it all still goes to the apache error.log file.

我已經嘗試了不同的組合,停止並啟動httpd並驗證這些設置在phpinfo()中被識別,但它仍然轉到apache error.log文件。

How can I get php error_log() output in a separate file from the httpd error.log file?

如何從httpd error.log文件的單獨文件中獲取php error_log()輸出?

PHP 5.3.5
Server version: Apache/2.2.3

PHP 5.3.5服務器版本:Apache / 2.2.3

Thanks

2 个解决方案

#1


2  

... The file should be writable by the web server's user ...

...該文件應該可由Web服務器的用戶寫入...

Source: http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log

try to change the the log directory to e.g. /var/log/php/my_php_errors.log make sure the folder exists:

嘗試將日志目錄更改為例如/var/log/php/my_php_errors.log確保文件夾存在:

mkdir /var/log/php/

/etc/... is usually used not for logging use some folder/file in /var/log/... instead

/ etc / ...通常不用於記錄使用/ var / log / ...中的某些文件夾/文件

#2


1  

Is there a reason you're using two different log paths?

您是否有使用兩種不同日志路徑的原因?

error_log = /etc/httpd/logs/php_error.log
php_value error_log /etc/php/logs/php_error.log
                         ^^^^

Does /etc/php/logs exist?

/ etc / php / logs是否存在?


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/02/04/ac5952a9dece447300c3ba5f07583d8a.html



 
  © 2014-2022 ITdaan.com 联系我们: