Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Enabling CGI using XAMPP for Mac OS X

by Shuraski (Scribe)
on Feb 13, 2010 at 16:45 UTC ( #823034=perlquestion: print w/replies, xml ) Need Help??
Shuraski has asked for the wisdom of the Perl Monks concerning the following question:

Is anyone experienced at enabling CGI using XAMPP for Mac OS X? I would like to use perl to execute scripts from cgi-bin/. After having read the on-line manuals, asked around, and read the on-line manuals again, the server is still giving me:

Error 403 Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server.

Which obviously tells me this is a permissions issue.

I believe my permissions are correct:

In cgi-bin/

-rwxr-xr-x 1 root admin 43 Jan 28 07:06

In the error_log:

in error_log: Options ExecCGI is off in this directory/Applications/XAMPP/xamppfiles/cgi-bin/

So, I go to httpd.conf to turn ExecCGI on:

Lines from httpd.conf file:

ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServe +r/CGI-Executables/$1"

(That looks funny, btw, but I have not changed it...

AddHandler cgi-script .cgi .pl # "/Library/WebServer/CGI-Executables" should be changed to whatever y +our ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/Library/WebServer/CGI-Executables"> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory>

That did not work, so I tried enabling CGI in the directory that my cgi executable files are in:

<Directory "/Applications/XAMPP/xamppfiles/cgi-bin/"> AllowOverride None Options Indexes FollowSymLinks MultiViews ExecCGI Order allow,deny Allow from all </Directory>

But still the 403 error persists

Could the problem be here? When calling ls -l in the XAMPP directory:

drwxr-xr-x 3 user admin 102 Aug 16 07:35 XAMPP lrwxr-xr-x 1 user admin 18 Sep 27 09:49 cgi-bin -> xamppfiles/cgi +-bin lrwxr-xr-x@ 1 user admin 14 Sep 27 09:49 etc -> xamppfiles/etc lrwxr-xr-x 1 user admin 17 Sep 27 09:49 htdocs -> xamppfiles/htdo +cs lrwxr-xr-x@ 1 user admin 15 Sep 27 09:49 logs -> xamppfiles/logs drwxr-xr-x@ 23 root admin 782 Aug 16 07:36 xamppfiles

Is there a problem with the Symlinks? Any help would be very much appreciated.

I am running Mac OS X 10.5.7, with XAMPP for Mac OS X (Apache 2.0, Perl5, mod_perl 2.0.4)

Thank you!

Replies are listed 'Best First'.
Re: Enabling CGI using XAMPP for Mac OS X
by juster (Friar) on Feb 13, 2010 at 19:16 UTC

    edit: My original post below is besides the point! The httpd.conf original content you typed is identical to the default httpd.conf for Mac OS X's included apache server. I just now found this when I decided it was time to configure my own Mac OS X 10.6's web.

    This leads me to believe you are editing the wrong httpd.conf. Which file are you editing? The httpd.conf under /etc is for the included apache and (according to XAMPP's website) XAMPP's is located at /Applications/XAMPP/etc/httpd.conf. A first step would be to make sure XAMPP's apache is not conflicting with Mac OS X's included web server.

    Original post follows:

    In your <Directory> directive, the directory in quotes is where the symlink points to, not the name of the symlink:

    <Directory "/Applications/XAMPP/xamppfiles/cgi-bin/"> ... lrwxr-xr-x 1 user admin 18 Sep 27 09:49 cgi-bin -> xamppfiles/cgi +-bin
    Maybe if you change to "/Applications/XAMPP/cgi-bin" inside the <Directory directive, Apache will be happy.

    Here is a quote from the manual about the FollowSymLink option:

    Note: even though the server follows the symlink it does not change the pathname used to match against <Directory> sections.

      I think you are right. With XAMPP installed, there are now 2 Apache configurations present. Obviously important to keep httpd.conf files straight. I will go sort this out.

      Is it enough to simply have Mac's original Apache turned off while using XAMPP to avoid conflicts?

      Thanks for catching this!

        Ya I think you are right. Turn off Web Sharing or have the XAMPP server listen on a different port and you should be okay.
Re: Enabling CGI using XAMPP for Mac OS X
by 7stud (Deacon) on Feb 14, 2010 at 04:42 UTC

    A) Don't touch the system install of Apache.

    B) Are you aware that you have to stop and re-start Apache for the changes to take effect?

    C) Before proceeding any further, read the following at the Apache website:

    D) Here are some relevant sections from my httpd.conf that may help you (not listed in any specific order). I installed Apache 2.2.4 in the directory /Library on mac osx 10.4.11:

    1) DocumentRoot "/Library/Apache2/htdocs" 2) # First, we configure the "default" to be a very restrictive set of # features. # <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. 3) <IfModule alias_module> # # Redirect: Allows you to tell clients about documents that used t +o # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. # Example: # Redirect permanent /foo # # Alias: Maps web paths into filesystem paths and is used to # access content that does not live under the DocumentRoot. # Example: # Alias /webpath /full/filesystem/path # # If you include a trailing / on /webpath then the server will # require it to be present in the URL. You will also likely # need to provide a <Directory> section to allow access to # the filesystem path. # # ScriptAlias: This controls which directories contain server scri +pts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications an +d # run by the server when requested rather than as documents sent t +o the # client. The same rules about trailing "/" apply to ScriptAlias # directives as to Alias. # ScriptAlias /cgi-bin/ "/Library/Apache2/cgi-bin/" </IfModule> 4) <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings f +rom # filename extension to MIME-type. # TypesConfig conf/mime.types # # AddType allows you to add to or override the MIME configuration # file specified in TypesConfig for specific file types. # #AddType application/x-gzip .tgz # # AddEncoding allows you to have certain browsers uncompress # information on the fly. Note: Not all browsers support this. # #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz # # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz # # AddHandler allows you to map certain file extensions to "handler +s": # actions unrelated to filetype. These can be either built into th +e server # or added with the Action directive (see below) # # To use CGI scripts outside of ScriptAliased directories: # (You will also need to add "ExecCGI" to the "Options" directive. +) # # # I uncommented the following line and added '.pl' to the end of i +t: AddHandler cgi-script .cgi .pl 5) # Below I changed AllowOverride from None to FileInfo to get mod_pytho +n # CGI Handler to work with a .htaccess file in the cgi-bin directory. # <Directory "/Library/Apache2/cgi-bin"> AllowOverride FileInfo Options None Order allow,deny Allow from all </Directory>

      Listen, thanks to all above for the help. Yes, the problem was entirely that I was editing the wrong copy of httpd.conf -- quite stupid of me. Now have configured the correct version of the file, and CGI executes normally.

      Thank you again for the assistance!

        Hi Shuraski! You have found the way to enable CGI. Please can you write it stepwise Regards
Re: Enabling CGI using XAMPP for Mac OS X
by Anonymous Monk on Feb 13, 2010 at 17:32 UTC
    Probably faq in the A manual :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://823034]
Front-paged by keszler
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-05-23 08:15 GMT
Find Nodes?
    Voting Booth?