Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Problems with CGI' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Problems with CGI
Authored by: robg on Mar 16, '01 10:22:18PM

If it's short enough, can you post it here? Or compare it to the test CGI script and see if you notice any obvious differences? How did you create the scripts? In vi, or using a GUI-based editor? Have you checked for Mac line breaks vs. UNIX line breaks?



[ Reply to This | # ]
Problems with CGI
Authored by: Anonymous on Mar 19, '01 09:22:35PM

It's not the cgi script. On my W2K server, to get cgi scripts to work, I put them in a directory which I create called cgi-bin in the site root directory. Then I just type: http://localhost/cgi-bin/file_name.cgi and the browser processes the cgi script. My problem seems to be how different the installation of Apache is in OS X. Things are in different places and named differently than they are in a normal Unix installation. If I put my cgi scripts in CGI-Executables, then I can't access them because they're one level above the site root directory, so http://localhost, etc. doesn't work. So I tried creating a cgi-bin directory inside the Documents directory, which I suppose is the same as htdocs or site root directory . I gave the directory executable privileges, but when I type in http://localhost/cgi-bin/file_name.cgi, the browser says it can't find the file. Gee, what the heck do you do in OS X's Apache to make cgis work?
P.S. I configured Apache as per your instructions in your article.



[ Reply to This | # ]
Odd, works fine here...
Authored by: robg on Mar 19, '01 09:35:18PM

I have another installation of OS X PB where I hadn't enabled CGI's yet, so I just did. I followed the steps outlined in this thread, and it worked perfectly. I can open the two test CGI's, and a quick install of one of my CGI's worked as well. You shouldn't have to create any new directories anywhere. I was able to run the CGI by typing in "http://localhost/cgi-bin/test-cgi". You could also replace "localhost" with "127.0.0.1" and it will also work.

There must be something about the particular CGI. One of the things that's bit me more than once is Mac line breaks vs. UNIX line breaks. Open the file in 'vi' or 'emacs', and make sure it's free of ^M characters.

If you like, you could email me the CGI, and I'll see if I can get it running here...



[ Reply to This | # ]
Odd, works fine here...
Authored by: Anonymous on Mar 20, '01 05:30:42PM

You know what the problem was? I had earlier edited my apache.conf file using TextEdit and that screwed things up. I started over with a clean apache.conf file, enabled php and followed your instructions. Now perl CGIs work fine without a hitch. Boy am I happy now. I'm using Jedit to do my perl coding with. I'm wondering how the heck I can get it to do php tags and html tags. I guess that's asking a lot. I'm spoiled from being able to do HTML, CFML, Perl, PHP, and ASP inside ColdFusion Studio.



[ Reply to This | # ]
Odd, works fine here...
Authored by: joestalin on Aug 16, '02 06:07:58PM

Funny you should ask. I just started messing with PHP in my install. Check this out:
http://www.entropy.ch/software/macosx/php/



[ Reply to This | # ]