Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors for virtual host are not written to specified ErrorLog, but to default error_log

I have upgraded to Apache 2.2.22 on a Debian 7 VM. I have just installed it using apt-get and not made any config changes except to add my VirtualHost

<VirtualHost *:8001 *:80>
    ServerName devintegration.ie
    ServerAlias devintegration.ie
    DocumentRoot /sites/integration/development/docs
    ScriptAlias /console/ /sites/integration/development/console/
    ErrorLog /sites/logs/devintegration.ie-error_log
    CustomLog /sites/logs/devintegration.ie-access_log common
</VirtualHost>

The behavior I was used to was that any Perl errors or warns appeared in the error log specified in the virtual host. The behavior I'm now getting is that the Perl errors go to the common Apache log in /var/log/apache2 directory and the virtual host log just contains "Premature end of script headers".

I've done some googling on this but most of the results are about mod_perl. I did find this page and the last comment suggests that there was a change to how this works but no information was given as to whether it could be changed. Apache Log Forum "Any information written to stderr by a CGI script will be copied directly to the error log."

Is there a way to configure apache to direct Perl errors and warns to the error log specified in virtual host?

The previous Apache version I was using was 2.2.15.

like image 502
Yokall Avatar asked Nov 09 '22 19:11

Yokall


1 Answers

This is (was?) a longstanding bug in mod_cgid. Its status still is "RESOLVED LATER" which (apparently) means: "stop complaining - we'll do it in a later version, not now". Maybe it has been solved by now (your version, 2.2.22, is 3 years old), but I couldn't find any mention of it.

mod_cgid is the default .cgi handler in the threaded version of Apache. If you switch to mod_cgi, e.g. by using a non-threaded apache (like I do) that should solve your problem.

like image 78
Hans Lub Avatar answered Nov 15 '22 05:11

Hans Lub