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 > Mac OS X > Important: CGIs not working. Reinstalling apache?

Important: CGIs not working. Reinstalling apache?
Thread Tools
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Feb 6, 2003, 07:38 PM
 
OK here's the deal, I really need to get .cgi files working again. I was messing around with .htaccess files and some slight editing in the httpd.conf file. But I completely have a clean WebServer folder (backed it up and deleted it, created new folders) and resotred my httpd.conf... and CGI files still do not work. I don't know what more to do. By CGI files not working I mean, when I go to the CGI file I have hosted, I get an "Internal Server Error". My logs reports "Premature end of script headers". Even on scripts that used to work. So the scripts themselves are fine. Proper permissions and everything.

Now, figuring I would just reinstall Apache. I headed over to apache.com and downloaded Apache 2.0.39. Did everything... and then got an error about some parameters thing. Reading the ReadMe.platforms or whatever file, it notes exactly the error I was getting, and links to a guys site who has updated tools that are patched to work, but that site no longer works.

I'd rather try and modify my current apache installation rather than figure out how to install a new version... But whatever you guys can help me with... Thanks
     
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Feb 7, 2003, 03:13 AM
 
Just to check the obvious, are the permissions right in the cgi directory? Also, did you check to make sure the cgi path listed is right. (I assume it is right since you restored a backup - but just in case)

I had a similar problem a few months back and it ended up being a subtle permissions problem. Unfortunately it was one of those things I caused and fixed between the hours of 2 in the morning and 5 in the morning after drinking far too much diet Coke. So I can't really be sure of what I did nor how I fixed it. <grin>
     
Zim
Senior User
Join Date: Apr 2001
Location: Cary, NC
Status: Offline
Reply With Quote
Feb 7, 2003, 07:42 AM
 
Are these perl cgi scripts?

If so, using Terminal or an xterm, or whatever, cd over to the directory and run

perl -wc script.cgi

see what it tells you.

And I assume you've removed all the .htaccess files?

Lastly, perhaps.. can't remember, does php come enabled?

If so, try the simple test.php

Code:
<? print phpinfo(); ?>
Cheers,
Mike
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Feb 7, 2003, 09:30 AM
 
Premature end of header means your CGI has an error. You're probably missing a newline at the end of your script headers. For example, this simple CGI script will work:

Code:
#!/bin/sh cat << EOF Content-type:text/html <html> Hello!</html> EOF
But this one will not:

Code:
#!/bin/sh cat << EOF Content-type:text/html <html> Hello!</html> EOF
I'd try something simple (like the first example above) and see if it works. If not, get that working first. Make sure you have a ScriptAlias set up in your httpd.conf. If that works, and your other one does not, go from there with some print/echo statements and see where the problem occurs.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
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 12:36 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