• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Change error log location

Kaspar

API expert
Plesk Guru
I'd like to change the location PHP error log file to the same directory as the PHP file that caused the error.

So for example if a PHP file resides in domainname.com/httpdocs/classes/ and a error occurs a error log file is created in the same directory. This seems a bit harder to achieve than I anticipated.

I have been able to change the error log location to the document root of the domain by setting: error_log = "{DOCROOT}{\}error_log" in the PHP ini file. But I am not sure how to change the error log setting to use the same directory as the PHP file that caused the error.

Any one has any suggestions?
 
I don't think that's easily possible. You would have to create your own PHP framework and instruct all your PHP scripts to output any errors to a dynamic log file location. But then again I'm not a coder.

Anway, I would recommend to keep your PHP error logs outside of the document root, as they may contain sensitive information and you probably don't want anybody to be able to read your logs....
 
This is also a bad idea because a huge error log file can very quickly take up disk space on your domain, and therefore the domain will be suspended due to limit overusage.
 
Back
Top