CGI-Executables and running CGI on OSX
Alright everyone, this issue has plagued me since day one of OS X. I wan ttorun CGI scripts on my OS X box and I cannot get it to work. Everytime I try to run CGI I get:
[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/1.3.22 Server at XXXXXX Port 80<hr></blockquote>
Anoyone else have this problem or know how to fix it? It serves web pages properly otherwise. Just no CGI.
[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/1.3.22 Server at XXXXXX Port 80<hr></blockquote>
Anoyone else have this problem or know how to fix it? It serves web pages properly otherwise. Just no CGI.

Comments
You want to change the permissions on the directory where you're running the CGI scripts to allow the owner full control, the group read and execute and others read and execute. Do this by running this command in the terminal
chmod 755 yourdirectory
and then do the same thing to the cgi files.
If that doesn't work, you might want to check your source code. If the code is referencing a part of your system that isn't installed or installed in a different location you'll get the same 500 server message.
Example:
Sendmail could be installed in:
/usr/sbin/sendmail
/usr/lib/sendmail
/usr/bin/sendmail
So make sure your code is referencing it from the right place.
BTW, cgi-bin is just an alias for the CGI-Executables directory. Don't manually create that directory.
Ex: if you have a script called test.cgi in you /Library/WebServer/CGI-Executables directory, you would call it with: <a href="http://yourservername/cgi-bin/test.cgi" target="_blank">http://yourservername/cgi-bin/test.cgi</a> HTH.
Here's a little perl tidbit that will fix the problem, if that's what it is:
perl -pi -e 's/\
/\
/g' <filename>. HTH.
[code]
Content-type: text/html
</pre><hr></blockquote>
The second line is an empty line (just a "\
").
<strong>I just remembered! Mac line endings != Unix line endings. That's what drove me up the wall for, oh, 3 months. Maybe that's it? (To see, open up the terminal and look at the file in pico. If it's all on one line and garbled that's your problem.
Here's a little perl tidbit that will fix the problem, if that's what it is:
perl -pi -e 's/\
/\
/g' <filename>. HTH.</strong><hr></blockquote>
This actually fixed about 90% of the problem. Thanks. Now I am getting other errors. Maybe perl is messed up? the error is:
Software error:
Can't locate DBI.pm in @INC (@INC contains: ./ ./Sources ./install_modules /System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin /Library/Perl /Network/Library/Perl/darwin /Network/Library/Perl .) at (eval 7) line 3.
For help, please send mail to the webmaster ([no address given]), giving this error message and the time and date of the error. Expires: Mon, 26 Jul 1997 05:00:00 GMT Date: Thu, 07 Mar 2002 09:19:16 GMT Content-Type: text/html
<strong>DBI.pm I think is the perl connection to mysql, right? You've got to install that manually. Are you trying to connect to a database using perl?</strong><hr></blockquote>
Sorry, i should have told you what I was doing right off. i am trying to get <a href="http://www.ikonboard.com" target="_blank">Ikonboard</a> working under OS X for personal reasons. And the funny part is, without even knowing what I am doing you have been able to get more working for me than they have being the writers of the software. <img src="graemlins/bugeye.gif" border="0" alt="[Skeptical]" /> Although i chose to not do the mySQL DB as I just wanted to use their default database for posts. I do not expect to need the industiral strength of mySQl right now.