Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > problem: CGI & OS X

problem: CGI & OS X
Thread Tools
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
Jan 17, 2003, 07:25 AM
 
I'm trying to set my Powerbook up so that I can develop a website (with PHP, CGI, and the works) locally and then later upload to a remote server. I've gotten PHP installed and working, but the problem I'm running in to is with Perl/CGI.

I've asked around and supposedly CGI scripts are set to execute in the Library/WebServer/CGI-Executables directory. This is fine, however; I'd like to be able to use local cgi-bin directories as well, but this works for now. The problem is that I have a script that causes a 500 error every time I try and run it. I've compiled it locally and there are no errors. I've uploaded it to my remote site and it works fine. I've double checked the permissions on the file and they are fine. What am I missing here? Where would I find the log files?

What I need is an online manual that provides steps for setting up a production-level webserver on Mac OS X. If anyone knows where I could find this, or is willing to help me set my machine up, I'd greatly appreciate the help.

Thanks.
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jan 17, 2003, 03:01 PM
 
If you're getting the 500 error, then it means Apache is set up correctly and passing on the CGI files to the interpreter, but the interpreter is falling over somewhere. A very common problem I've found is that a CGI file I've created has Mac linefeeds (\r\n) instead of Unix linefeeds (\r). A quick trip to BBedit Lite or Full will sort this out.

You can nail the cause if you open the folder '/var/log/httpd/' in the finder, then open the error_log in your favourite text editor.

I'd recommend a good visit to the O'Reilly network to get some great advice for setting up OS X. Not only are the books pretty comprehensive, but they have some excellent online articles which deal specifically with setting up a webserver on OS X, including PHP, MySQL, BIND, Mail and much more...

http://mac.oreilly.com/
Computer thez nohhh...
     
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Jan 18, 2003, 01:26 PM
 
or...

open Terminal, paste this in: perl -pi -e 's/\r\n?/\n/g' , drop the file on the terminal window, hit enter. that should strip the line breaks down to unix-friendly versions
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:03 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2