1
votes

I upgraded my Debian7 to Debian10 yesterday, and changed from prefork to mpm_event with php-fpm (php 7.4)

The error messages and error_log output, is shown in my /apache/error.log file as: I've replaced filenames, ip and port.

[Tue May 19 11:26:38.506805 2020] [proxy_fcgi:error] [pid 28334:tid 139811391133440] [client (ip):(port)] AH01071: Got error 'PHP message: PHP Notice: Undefined variable: SQL_ERROR in (file) on line 198PHP message: PHP Notice: Undefined variable: SQL_ERROR in (file) on line 200PHP message: PHP Notice: Undefined variable: SQL_ERROR_MSG in (file) on line 201PHP message: PHP Notice: Undefined variable: SQL_command in (file) on line 202'

And all errors are buffered, and output on the same line (quite difficult to debug).

php-fpm uses www-data user

error.log has 640 permissions with www-data:www-data

php-fpm/pool.d/www.conf got the error.log = /var/log/apache2/error.log

Do you have any suggestions, as to why i'm not getting the error logs directly in the error.log file?

Edit: All PHP configs is from a clean install.

2

2 Answers

1
votes

I have the same system as you, Debian 10, php-fpm 7.3 (instead of 7.4), apache2 and had the same issue with a messy output.

I solved it with a small script, manually adding the new line character \n and also a tab \t for pretty printing

#!/bin/sh
tail -f "/var/log/apache2/$1" | sed 's/PHP\s/\n\tPHP\s/g'

Now I see each message on a new line, with a simple indentation as well. You can give the script any name, I choosed greplog, placed on system path with enough permissions, and pass the log filename as parameter

0
votes

When upgrading from Debian 7 to Debian 10 your version of PHP was probably upgraded from 5.4 to 7.4.

PHP 7 has many breaking changes so I'm guessing that your code is using some of the features that were removed / hits syntatical changes introduced.

See here for the debian php version matrix: https://wiki.debian.org/PHP

And here for PHP breaking changes: https://www.php.net/manual/en/migration70.incompatible.php