[英]php not logging errors log_errors=on, error_log path exists
使用php5.6(舊版代碼庫),apache,ubuntu16。
phpinfo()
表示: log_errors
位於error_log
= /var/log/apache2/php_errors.log
當display_errors
開啟時,將輸出。 但是/var/log/apache2/
不包含php_errors.log
文件。
重新啟動了apache( /etc/init.d/apache2 restart
)。
log_errors_max_len
為1024
。
ls -ld /var/log/apache2
drwxr-x--- 2 root adm 4096 Mar 30 18:47 apache2
ls -l /var/log/apache2
-rw-r----- 1 root adm 0 Mar 30 06:25 access.log
-rw-r----- 1 root adm 5967 Mar 30 01:47 access.log.1
-rw-r----- 1 root adm 11618 Mar 31 04:07 error.log
-rw-r----- 1 root adm 11742 Mar 30 06:25 error.log.1
我想念什么?
從上面的評論。 使用Apache2時,每個VirtualHost都可以擁有自己的日志文件。
因此, /etc/apache2/
目錄將具有以下sites-available
目錄:
├── sites-available
│ ├── 000-default.conf
│ ├── default-ssl.conf
│ ├── default-tls.conf
│ ├── www.domain.com.conf
│ └── www.domain.com-le-ssl.conf
和www.
文件可能類似於以下示例。
要設置與Apache日志分開的特定php日志文件,請遵循以下答案 :
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/domains/example.com/html
ErrorLog /var/www/domains/example.com/apache.error.log
CustomLog /var/www/domains/example.com/apache.access.log common
php_flag log_errors on
php_flag display_errors on
php_value error_reporting 2147483647
php_value error_log /var/www/domains/example.com/php.error.log
</VirtualHost>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.