PDA

View Full Version : Solution for the apache 2.0 / 2.2 Syntax error in httpd.conf


dwm
12-11-2007, 07:02 AM
If you are working on Debian with directadmin, you can compile your apache in several versions. Apache 2.0 and Apache 2.2 are the most used since Apache 1.3 is end-of-life.

Compiling the default apache 2.0 / 2.2 will give an error while starting:
/usr/local/directadmin/custombuild# /etc/init.d/httpd restart
Stopping httpd:
Starting httpd: [Tue Dec 11 14:40:40 2007] [warn] module php5_module is already loaded, skipping
Syntax error on line 70 of /etc/httpd/conf/httpd.conf:
<IfModule takes one argument, Container for directives based on existance of specified modules


This is because there is a syntax error in the default template. To fix this once and for allways perform these actions:


cd /usr/local/directadmin/custombuild/configure/ap2/conf/
pico httpd.conf_2.0

(vi, nano, or any other editor also okay)
Look now for this code around line 70:
#replace %b with %O for more accurate logging
<IfModule IfModule mod_logio.c>
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%O" bytes
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>


Replace it with this:
#replace %b with %O for more accurate logging
<IfModule mod_logio.c>
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%O" bytes
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>


What you have done now is deleting 1 'IfModule' statement. After this you have to re-generate your configs:

cd /usr/local/directadmin/custombuild/
./build rewrite_confs
/etc/init.d/httpd stop
killall httpd
/etc/init.d/httpd start
Starting httpd:


/etc/init.d/restart will sometimes make problems for this situation

dwm
12-12-2007, 03:28 AM
John confirmed this and changed the default templates! :cool: