Similar question has been asked already at php error_log not working but that's not my problem.
My phpinfo();
shows
Directive Local Value Master Value
error_log /var/opt/remi/php74/log/php-fpm/www-error.log /var/opt/remi/php74/log/php-fpm/www-error.log
max_execution_time 456 456
I try to change location to /var/log/php-fpm/www-error.log
, however the location always stays on /var/opt/remi/php74/log/php-fpm/www-error.log
not matter what I am doing
$ cat /etc/php.d/impng.ini
max_execution_time = 456
error_log = /var/log/php-fpm/www-error.log
I run systemctl restart httpd
/ systemctl restart php74-php-fpm
several times
I don't see file /var/opt/remi/php74/log/php-fpm/www-error.log
configured anywhere:
$ grep php_admin_value /etc/httpd/conf/*
$ grep php_admin_value /etc/httpd/conf.d/*
$ grep php_admin_value /etc/httpd/conf.modules.d/*
$ grep php_admin_value /etc/php.d/*
$ grep error_log /etc/php.d/*
/etc/php.d/impng.ini:error_log = /var/log/php-fpm/www-error.log
$ grep ErrorLog /etc/httpd/conf/*
/etc/httpd/conf/httpd.conf:# ErrorLog: The location of the error log file.
/etc/httpd/conf/httpd.conf:# If you do not specify an ErrorLog directive within a <VirtualHost>
/etc/httpd/conf/httpd.conf:ErrorLog "logs/error_log"
$ grep ErrorLog /etc/httpd/conf.d/*
/etc/httpd/conf.d/ssl.conf:ErrorLog logs/ssl_error_log
$ grep ErrorLog /etc/httpd/conf.modules.d/*
Note, errors are written properly to /var/opt/remi/php74/log/php-fpm/www-error.log
. Manual logging with error_log("test", 3, "/var/log/php-fpm/www-error.log");
is also working.
But I don't manage to change the location of error_log
. Other parameters (e.g. max_execution_time
) are taken properly into account as expected.
It's a minor issue, I could create symbolic link or simply read file /var/opt/remi/php74/log/php-fpm/www-error.log
. However, I wonder why I cannot change it.
CodePudding user response:
Which distribution/version?
In Fedora and RHEL / CentOS 8 PHP is executed via the php-fpm service And the log is configured in the pool configuration file.
# cat /etc/opt/remi/php74/php-fpm.d/www.conf
...
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
php_admin_value[error_log] = /var/opt/remi/php74/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 128M
; Set the following data paths to directories owned by the FPM process user.
;
; Do not change the ownership of existing system directories, if the process
; user does not have write permission, create dedicated directories for this
; purpose.
;
; See warning about choosing the location of these directories on your system
; at http://php.net/session.save-path
php_value[session.save_handler] = files
php_value[session.save_path] = /var/opt/remi/php74/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/opt/remi/php74/lib/php/wsdlcache
;php_value[opcache.file_cache] = /var/opt/remi/php74/lib/php/opcache
;php_value[opcache.preload] = /var/www/html/preload/preload.php
;php_value[opcache.preload_user] = apache
It has to be configured in the spool file, as each pool may run under a different user, so each needs its own files.
Tips: you can see the configuration files provided by a package using:
# rpm --query --configfiles php74-php-fpm
/etc/httpd/conf.d/php74-php.conf
/etc/logrotate.d/php74-php-fpm
/etc/opt/remi/php74/php-fpm.conf
/etc/opt/remi/php74/php-fpm.d/www.conf