At 10:02 AM -0500 1/23/2002, Frank Nospam wrote:
>Also, Apple says that with their default Apache running,
> I should be able to use the default CGIs. However,
> http://localhost/printenv returns a 404 for me.
> What's going wrong?
I can't answer the other ones, but this one is fairly straightforward.
If you take a look at /var/log/httpd/error_log, it will show an error
along the lines of:
[client 127.0.0.1] File does not exist: /Library/WebServer/Documents/printenv
So, this isn't the correct place where printenv lives and it isn't
the correct way to access it.
% locate printenv
Shows that it's at: /Library/WebServer/CGI-Executables/printenv
The configuration file at /etc/httpd/httpd.conf includes this bit:
<IfModule mod_alias.c>
#[.. snip ..]
#
# 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/ "/Library/WebServer/CGI-Executables/"
#
# "/Library/WebServer/CGI-Executables" should be changed to whatever your
ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</IfModule>
So, the correct path is:
http://localhost/cgi-bin/printenv
But on my system, that also fails, /var/log/httpd/error_log shows:
[client 127.0.0.1] file permissions deny server execution:
/Library/WebServer/CGI-Executables/printenv
Checking that file,
% ls -ld /Library/WebServer/CGI-Executables/printenv
Shows me that its executable bits aren't set. If I set those,
% sudo chmod +x /Library/WebServer/CGI-Executables/printenv
The URL,
http://localhost/cgi-bin/printenv
now works. For safety, though, it's good to disable CGIs that you don't
actively need with:
% sudo chmod -x /Library/WebServer/CGI-Executables/printenv
just in case someone finds a security flaw with one of the factory-installed
CGIs.
-Charles
[EMAIL PROTECTED]