To split php_error_log in cronolog

Asked 2 years ago, Updated 2 years ago, 67 views

I am having trouble dividing php_error_log using cronolog.

By writing httpd.conf as shown below, ErrorLog and CustomLog have been successfully split by cronolog

-rw-r --r--1 root root 370592 January 26 23:42 access_log.2015.01.26
-rw -r --r --1 root root 4680 January 27 10:14 access_log.2015.01.27
-rw -r --r --1 root root 233081 January 26 19:35 error_log.2015.01.26
-rw -r --r --1 root root 148 January 2709:12 error_log.2015.01.27

is the

of httpd.conf
php_value error_log"|/usr/sbin/cronolog/home/htdocs/logs/php_error_log.%Y.%m.%d"

The part of does not work well.The files themselves will not be created in the logs folder.

However,

php_value error_log "/home/htdocs/logs/php_error_log"

As we can output php_error_log without division without cronolog like in , I think there is no problem with permission of logs folder and setting php.ini.
The permission for /home/htdocs/logs is apache:apache.

drwxr-xr-x2 apache apache 4096 January 2709:12 logs
<VirtualHost xxxxxxxxxxx.jp:80>
DocumentRoot "/home/htdocs/xxxxxxxxxxxx"
ServerName xxxxxxxxxxxxx.jp:80
ServerAlias www.xxxxxxxxxxxxxxxx.jp
ErrorLog " | /usr/sbin/cronolog/home/htdocs/logs/error_log.%Y.%m.%d"
CustomLog" | /usr/sbin/cronolog/home/htdocs/logs/access_log.%Y.%m.%d "combined

<Directory"/home/htdocs/xxxxxxxxxxx">
    php_value error_log" | /usr/sbin/cronolog/home/htdocs/logs/php_error_log.%Y.%m.%d"
</Directory>

php linux centos apache

2022-09-30 17:34

1 Answers

The PHP error log cannot be a pipe as shown below.

php_value error_log"|/usr/sbin/cronolog/home/htdocs/logs/php_error_log.%Y.%m.%d"

This statement only describes the PHP configuration in the Apache configuration file, so you can use the pipe in Apache's ErrorLog or CustomLog, or you can use the pipe in PHP's error_log.

The php error log needs to be rotated by logrotate, etc., or the error_log configuration needs to be sysloged.

Alternatively, if you leave the error_log unconfigured, the PHP error log will also be printed in the Apache error log, so cronolog is available in the Apache ErrorLog directive.


2022-09-30 17:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.