Send php errors to logs

I ran into a problem with php and nothing was displaying in /var/log/php-fpm/www-error.log or in /var/log/httpd/ssl_error_log.

I had to edit php.ini to display_errors = On so the error would show in the browser.

The error was the following which would normally show in Centos/rhel 7
Warning: require_once(/usr/share/pear/CAS.php): Failed to open stream: No such file or directory in /var/www/secure/html/_includes/CASwrap.php on line 8

What can I edit to get one of two logs mentioned to capture such errors?

In general you should not edit php.ini files in RHEL/Rocky anymore, and displaying errors in browsers is only for kids, better to use logging.
Check packages:
rpm -q httpd
rpm -q php-fpm
Assuming you have the default setup, php logging should be working, but make sure you’ve actually got log directives enabled, and that they are for the correct virtual host.
In php-fpm, you should see directory
and within that you can check the “pool” that you are using, e.g. ‘www’. Within the pool you can add php-fpm directives, e.g.
php_admin_value[memory_limit] = 128M
In your case, the error you’re looking for is a warning, so the error level might not be high enough.

@gerry666uk in php-fpm.d/www.conf which parameter sets the error level?

I checked on two production servers today, and they are both logging warnings and errors from php, so there may be some other issue with your setup. It’s probably best to write a ten line test script which echos some text, and then logs a warning and an error, and check to see that it’s in the logs (or not).

Thanks @gerry666uk I got it figured out, but I still need to determine which parameter in php-fpm.d/www.conf sets the error reporting level.

I believe its in /etc/php-fpm.conf

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

Ok, but you don’t say how you resolved it?

Strangely my www.conf has no such Log level entry. I know I searched for it before asking and I just double checked it to see if I was blind.

@gerry666uk I don’t know exactly what happened, but after the initial install and setup of php-fpm /var/log/php-fpm directory had just one file called error.log. I created an alias (just like on other systems) to open it with the tail command so I wouldn’t have to keep typing it. And so, I was looking at error.log, which only states fpm is running, while all the time I thought I was looking at www-error.log. Head-banger mistake.

Ah, OK - that explains a lot.