• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How to localize PHP-FPM logs into domain's log folder?

J.Wick

Regular Pleskian
Server operating system version
Rocky Linux 8.6
Plesk version and microupdate number
Version 18.0.51
Is there a guide on setting up php-fpm to log to its client log in their log folder?

I've had a few clients who had the warning deprecation log flood caused by the actual site's code; nothing php.ini had control over growing into huge multi-GB files.

1) I want these log files in the client's log location so the client can have access and be alerted their code is junk or PHP settings are too high.

2) Warning emails will be dispatched when file quotas are reached before hitting their max so we can react.

If this can't be done, please explain why?
 
All PHP-FPM errors related to a domain are already logged to the domain's standard web server log files. The log rotation of the files can be configured to various settings using the "Logs" > "Manage Log Files" > "Log Rotation" settings of a subscription.

Regarding warning emails, these can be configured in "Tools & Settings" > "Plesk" > "Notifications". If you need more frequent checks or custom notifications or custom rotation of log files, it'll probaby be necessary to develop a small shell script for that.
 
All PHP-FPM errors related to a domain are already logged to the domain's standard web server log files. The log rotation of the files can be configured to various settings using the "Logs" > "Manage Log Files" > "Log Rotation" settings of a subscription.

Regarding warning emails, these can be configured in "Tools & Settings" > "Plesk" > "Notifications". If you need more frequent checks or custom notifications or custom rotation of log files, it'll probaby be necessary to develop a small shell script for that.
I looked in my log folder of the domain that was causing problems, and I don't see any of the log entries nor any files similar in size.

Modification dateNamePathSize
May 3, 2023 03:08 AMnginx SSL/TLS accesslogs/proxy_access_ssl_log1.97 MB
May 3, 2023 01:42 AMnginx errorlogs/proxy_error_log3.70 KB
May 3, 2023 12:17 AMnginx accesslogs/proxy_access_log246 B
May 2, 2023 04:10 AMApache errorlogs/error_log0 B
Sept 11, 2022 03:28 AMApache SSL/TLS accesslogs/access_ssl_log0 B
Sept 10, 2022 03:35 AMApache accesslogs/access_log0 B
 
What files did you mean in your first post?

In addition to the files that you can see in the /logs directory of a subscription there could be more logs here:
- in /logs/<add on domain name>
- in /var/log/*
 
What files did you mean in your first post?

In addition to the files that you can see in the /logs directory of a subscription there could be more logs here:
- in /logs/<add on domain name>
- in /var/log/*
I was referring to the domain client's log folder. /var/www/vhosts/system/*/logs

How can clients see their script's PHP errors when running php-fpm mode?

I'm assuming since plesk-php81-fpm is configured with /opt/plesk/php/8.1/etc/php.ini, being a system-wide service, is logged into a pool in the /var/log/plesk-php81-fpm/errors.log

What I would like is to have PHP errors logged to their client domain log: /var/www/vhosts/system/*/logs/plesk-php81-fpm/error.log

Then this would be available for them to see on their log screen.

Does this make sense?
 
Yes, that makes sense. However, the individual domain error log is already the place where such errors are being logged. If errors are not logged, it is probably due to either an error_reporting(0) setting, or the "log errors" option on the PHP settings page is "off".
 
Yes, that makes sense. However, the individual domain error log is already the place where such errors are being logged. If errors are not logged, it is probably due to either an error_reporting(0) setting, or the "log errors" option on the PHP settings page is "off".
I think you would need to have the hosting set to "Dedicated FPM application" for this to be able to work on a domain-basis at all.
Otherwise that would not be possible as the normal "FPM application served by ..." pool is not unique to the individual domain.
 
@J.Wick Could you please give me some examples what kind of error messages you expect to see in the log? I am asking because I've been developing software for decades and we always saw the PHP error messages in the normal error_log file of the domain, including on Plesk hosts. Maybe I got you totally wrong that you are talking about something that would belong into /var/log/messages instead, e.g. service stop/start?
 
@J.Wick Could you please give me some examples what kind of error messages you expect to see in the log? I am asking because I've been developing software for decades and we always saw the PHP error messages in the normal error_log file of the domain, including on Plesk hosts. Maybe I got you totally wrong that you are talking about something that would belong into /var/log/messages instead, e.g. service stop/start?
Well, I guess I have perfect code cause nothing ever gets logged to the error_log file. Error reporting in PHP was off, I just enabled it today.

I'd like to see a segmented log file specifically for PHP errors. Actually now, thinking about it, I'd like a log file for every service utilized by the client account.

• Apache/NGINX
• PHP
• MariaDB/MysQL/PostGreSQL
• Cron
• SSH/sFTP

As well as having all this available for the server administrator to check and address issues.
 
If error reporting was off than surely you did not see any errors logged.

Nginx and Apache already have separate log files. PHP errors are logged to the Apache logs by default. If you want PHP errors logged separately, the error_log variable in php.ini needs to be adjusted. MariaDB etc. already have their own error logs, but as there is one database server for all accounts on the server, they also log their transactions only into one log and /var/log/messages. The same applies to cron, SSH, FTP etc. All system services.

Here is an article on important log and configuration file locations: https://support.plesk.com/hc/en-us/...r-Linux-services-logs-and-configuration-files
 
I believe those are the direct php code errors. However, other fpm related errors in php-fpm/errors.log do not seem to be logged into the Apache logs as you suggested. For example, we found many "reached max_children" in the fpm logs that we were not visible in Apache logs.
 
Back
Top