PHP error_log

jigster

Verified User
Joined
Jul 23, 2021
Messages
101
Hi everyone. We'd prefer to have a separate PHP error log in the site's root or logs directory for every account, but I'm having a little trouble: If I create a file /usr/local/php83/lib/php.conf.d/11-custom.ini and add
error_log = php_error_log
this creates the log file in the same directory as the php script causing the error, so we end up with multiple logs in multiple directories.

Does anyone know how we can set it so every account automatically has a separate PHP error log in the site's root or their logs directory, without having to hard code a different absolute path for every site? Thanks
 
Last edited:
Thanks @zEitEr that's just what I needed! As we want it set for all users, I used the global option - https://docs.directadmin.com/webser...h-to-have-global-custom-php-fpm-configuration with placeholders |USER| and |DOMAIN|. For anyone else needing to globally change the location of the php error logs for every account, here's what I did:

In /usr/local/directadmin/data/templates/custom/php-fpm.conf.custom2 I added:
Code:
php_admin_value[error_log] = /home/|USER|/domains/|DOMAIN|/logs/php_errors.log
Then
Code:
da build rewrite_confs
service php-fpm83 restart

So far it's working perfectly, creating php_errors.log if it doesn't already exist.
 
Back
Top