Problem with cPanel error log and LiteSpeed

Sindre

Well-Known Member
#1
Hello,

I am currently struggling with a problem related to the cPanel Error Log and LiteSpeed configured with suEXEC. I have set PHP to log errors to the server error_log in /usr/local/apache/logs/error_log. In LiteSpeed, the server error log level is set to Warning and the File Name = /usr/local/apache/logs/error_log.

The problem is that in order for PHP to be able to write to the error log, the log file must be world-writable (chmod 666) because of suEXEC. On log rotation, the permissions of the log file is reset to 644 and PHP errors are not logged. Is this expected behavior, or is there a solution to this problem? Now I have to pay attention to when the log is rotated, and then change the permissions manually.

With Apache I never had any problems with the error logs, so this is the only issue I have with LiteSpeed at the moment.

The best solution would be if each PHP error log could be stored in clients home directory (is this how cPanel/Apache does it by default?), instead of having a single server-wide file. However, I have not figured out how to accomplish this with cPanel.

Any advise is appreciated.
 

mistwang

LiteSpeed Staff
#2
For log rotation, you can set the rotation point higher, and rotate it with your cron job, just "mv ..." will work, then create the log file with correct permission.

The best solution would be if each PHP error log could be stored in clients home directory (is this how cPanel/Apache does it by default?), instead of having a single server-wide file. However, I have not figured out how to accomplish this with cPanel.

Any advise is appreciated.
If you know how to customize cPanel's vhost template, you can add a

php_value error_log ....

directive to the vhost template.
 

Sindre

Well-Known Member
#3
If you know how to customize cPanel's vhost template, you can add a

php_value error_log ....

directive to the vhost template.
Thanks, I haven't thought of that. However, do you know if cPanel will read error_log file from users home directory and display in cPanel -> Error Log page? Should the log file have owner of suEXEC user?
 

mistwang

LiteSpeed Staff
#4
Thanks, I haven't thought of that. However, do you know if cPanel will read error_log file from users home directory and display in cPanel -> Error Log page? Should the log file have owner of suEXEC user?
I do not know, not likely cPanel does that.
But it is in user's home directory owned by that user, so they should have no problem accessing those files.
 
#5
On second thoughts i believe that the module is being loaded twice.
Is there any reason why apache would do that?
there is only one entry in the httpd.conf file.
 
Top