Perl won't work in OSX Server

sandpilot

Registered
Hello All-

I am having a heck of a time trying to get perl scripts to run in OSX.1.4. I think I have done all of the right steps to get things up and running. Here is a list of what I have done so far. 1. I have modified the httpd.conf file to be able to use SSI's. 2. Changed the location of the web folder from /Library/WebServer/Documents/ to /Intranet/. 3. inside of the /Intranet/ folder I have a cgi-bin folder that I copied the Apple default files 'test-cgi' and 'printenv'. The 'test-cgi' file will work just fine and return the info that it is susposed to, but if, from my browser, I input the path to 'printenv' I get the message 'Forbidden - You don't have permission to access /cgi-bin/printenv on this server.' or another perl script called 'iBtest.cgi' I get Internal Server Error - The server encountered an internal error or misconfiguration and was unable to complete your request. I have also gone in done a chmod 0777 to all of the files in the cgi-bin folder. I'm just not sure where to go from here. Is this enough info for the problem or do you need more info. Let me know. Thanks for any help.

Oh- one last thing - the path in the perl scripts is-
#!/usr/bin/perl


John
john.nicholson@avpress.com
 
John, there is a seperate Apache directive for CGIs you forgot to edit in httpd.conf. Go back and look for it, make the changes, restart Apache and try again. The reason you're having trouble is Apache is still serving the scripts from /Library/WebServer/CGI-Executables!

Keep in mind if you copied the files in the Finder your privs most likely have changed for the scripts you are trying to call (the Finder will change the ownership of the files you are copying to your own). You should change them from the terminal with sudo chown www.www (your file names)

Let me know if this helps!

P.S. Any scripts you put in there should be saved as text files with UNIX line-endings! perl will barf on Mac files!
 
Originally posted by trevor
Any scripts you put in there should be saved as text files with UNIX line-endings! perl will barf on Mac files!
Just to clarify trevor's statement: You can't edit Perl scripts in TextEdit. You need to use something that will put Unix line endings (I can never remember which is which, so don't ask ;) ). BBEdit will do this (I use Lite, since I'm cheap) and from the Terminal, Pico will do this.

Sandpilot: The path in the scripts has to match your Perl installation. Mine is #!/usr/bin/perl, so you're probably fine. To find out for sure on your machine, type which perl to see where the Perl binary is located.
 
Hey Guys-

Thanks for the response!! It help a bunch. After doing all of the suggestions that you gave, it worked great!! Once again, THANKS, I'm well on my way to getting my web server up and running now.

John
 
Back
Top