arrow-left arrow-right brightness-2 chevron-left chevron-right facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Per-user CGI through Apache on Mac OS X
1 min read

Per-user CGI through Apache on Mac OS X

For the past two hours I’ve been losing my goddamn mind trying to get CGI scripts to work on my local Mac OS X machine so that I can test some things for the third edition of Google Hacks. I usually do this sort of thing on remote shells, but because I couldn’t get this particular piece of code working on the other machines (through no fault of the code), I decided to try and run it locally.

After making the necessary changes to the httpd.conf file I tried running some CGI scripts from my web folder and kept getting 403 (Forbidden) errors. I knew my permissions were correct and so I was left to rifle through the logs to see what I could find; the httpd error log told me the following:

[Sat Apr  1 00:23:54 2006] [error] [client] Options ExecCGI is off
in this directory: /Users/justin/Sites/foo.cgi

This really threw me for a loop because I explicitly added ExecCGI privileges to that directory through httpd.conf. After almost two hours of editing various files and restarting httpd, I found the following on line 1107 (the very last line!) of my httpd.conf file:

Include /private/etc/httpd/users/*.conf

Sure enough, the justin.conf file found in /private/etc/httpd/ was overriding the changes I made to the httpd.conf file. Once I nailed that down it was just a matter of commenting out the line.1

I’m sure this is documented somewhere, but I couldn’t find it, likely because it’s been a long-ass day and I’m having trouble focusing. And on that note, good night.

  1. Instead of commenting out this line you could just as easily modify your respective conf file in /private/etc/httpd/; this is probably the better option for multi-user systems because it keeps everyone’s configurations separate.   

You've successfully subscribed to P O L Y M A T H.
Success! Your account is fully activated, you now have access to all content.