Hi -
I'm having some problems with my cgi script. Can you tell me what I'm doing wrong?
script:
#!/usr/bin/perl
print "Content-type: text/plain";
print "test text";
inside httpd.conf:
<IfModule mod_alias.c>
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons/ "/usr/local/etc/httpd/apache/icons/"
<Directory "/usr/local/etc/httpd/apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/etc/httpd/apache/cgi-bin/"
ScriptAliasMatch ^/cgi-bin /home/*/public_html/cgi-bin
#
# "/usr/local/etc/httpd/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/etc/httpd/apache/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
<Directory "/home/*/public_html/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
</IfModule>
Error msg:
500 Internal Server Error
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
tail error_log -n 3:
[Sat Oct 27 00:08:28 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=CGI access is working: /home/leo/public_html/cgi-bin/test.cgi
[Sat Oct 27 00:10:51 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=Content-type=text/plain: /home/leo/public_html/cgi-bin/test.cgi
[Sat Oct 27 00:12:34 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=Content-type=text/plain: /home/leo/public_html/cgi-bin/test.cgi
i'm using Drake 8, and if you can't tell I'm an absolute newbie at apache.
Also, I'm trying to make it so ~user/cgi-bin/ can execute cgi-scripts. I know that I should get a CGI-Wrapper for security reasons, but since the machine isn't live yet it isn't too much of a concern...
TIA leo
------------
Leo Mendoza
lmendoza@students.depaul.edu
I'm having some problems with my cgi script. Can you tell me what I'm doing wrong?
script:
#!/usr/bin/perl
print "Content-type: text/plain";
print "test text";
inside httpd.conf:
<IfModule mod_alias.c>
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons/ "/usr/local/etc/httpd/apache/icons/"
<Directory "/usr/local/etc/httpd/apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/usr/local/etc/httpd/apache/cgi-bin/"
ScriptAliasMatch ^/cgi-bin /home/*/public_html/cgi-bin
#
# "/usr/local/etc/httpd/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/etc/httpd/apache/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
<Directory "/home/*/public_html/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
</IfModule>
Error msg:
500 Internal Server Error
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
tail error_log -n 3:
[Sat Oct 27 00:08:28 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=CGI access is working: /home/leo/public_html/cgi-bin/test.cgi
[Sat Oct 27 00:10:51 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=Content-type=text/plain: /home/leo/public_html/cgi-bin/test.cgi
[Sat Oct 27 00:12:34 2001] [error] [client 127.0.0.1] malformed header from script. Bad header=Content-type=text/plain: /home/leo/public_html/cgi-bin/test.cgi
i'm using Drake 8, and if you can't tell I'm an absolute newbie at apache.
Also, I'm trying to make it so ~user/cgi-bin/ can execute cgi-scripts. I know that I should get a CGI-Wrapper for security reasons, but since the machine isn't live yet it isn't too much of a concern...
TIA leo
------------
Leo Mendoza
lmendoza@students.depaul.edu