furlxy 发表于 2019-7-11 14:28:03

php的error.log写了两个文件是为啥?

本帖最后由 furlxy 于 2019-7-11 14:29 编辑

昨天打开了php-fpm的error, /usr/local/php/etc/php-fpm.conf配置如下:


pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice


listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 20
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 20
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log
php_admin_value = /usr/local/php/var/log/php_errors.log
php_admin_flag = on
php_flag = On

然后我写了个错误的代码想试一下php是不是会保存log发现存了两份log,分别在/home/wwwroot/xxx(我的域名目录) 这个目录下会生成一个error.log,同时又在/usr/local/php/var/log/php_errors.log 这个目录也生成一个错误文件
这是为啥啊?如何只让php-fpm只生成一份错误log呢?

furlxy 发表于 2019-7-11 14:31:06

看了下代码,有个文件设置了ini_set('error_log', dirname(__FILE__) . '/error.log'); :L 尴尬
页: [1]
查看完整版本: php的error.log写了两个文件是为啥?