I attempted to configure Apache to execute all web pages as CGI scripts. Here are the significant lines from httpd.conf:
Expand|Select|Wrap|Line Numbers
- ServerRoot "/tools/apache"
- DocumentRoot "/tools/apache/htdocs"
- <Directory "/tools/apache/htdocs">
- Options Indexes FollowSymLinks ExecCGI
- AllowOverride None
- Order allow,deny
- Allow from all
- </Directory>
- <IfModule alias_module>
- ScriptAlias /cgi-bin/ "/tools/apache/htdocs/"
- </IfModule>
- <IfModule mime_module>
- TypesConfig conf/mime.types
- AddType text/html .exe
- AddHandler cgi-script .exe
- </IfModule>
[Tue Feb 05 09:02:56 2008] [error] [client 192.168.0.101] Premature end of script headers: index.exe
The access log reads:
192.168.0.101 - - [05/Feb/2008:09:02:56 -0700] "GET /index.exe HTTP/1.1" 500 535
Again, I know that index.exe produces valid HTML out. If I redirect its output to a file, say home.htm, then Apache will serve that HTML file just fine.
I guess I did something wrong in the config file, but I don't know what. I've read the documentation on the config parameters. I changed the ScriptAlias value from cgi-bin to htdocs because I want all the web pages in the main web folder, not in a separate place.
This is where I really struggle trying to understand. Why would CGI scripts be placed in a folder outside the main web site anyway? I also write PHP web sites served on hosted machines and I don't have to create a special folder for the PHP files.
Any help will be greatly appreciated. Thanks.