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 > A little Perl and CGI problem with Apache

A little Perl and CGI problem with Apache
Thread Tools
Mac Enthusiast
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
Apr 30, 2008, 09:13 PM
 
I am currently in a Perl&CGI class at school and I am in need to run these scripts via Apache on my Macbook. I went through the following tutorials by O'Reilly, Part 1 , Part 2. Now when I write a simple cgi script:
Code:
#!/usr/bin/perl print "Content-type: text/plain\n\nHet werkt!\n";
*Not all one line*
Then change it's permissions via terminal "chmod 755." I then go to my Macbooks URL and locate the file it just prints out the code. It should display "het werkt!" I am completely stumped as to what I am doing wrong. Everything seems to be connecting ok.

Any help would be greatly appreciated. Thanks in advance!
     
Mac Elite
Join Date: Oct 1999
Location: Philadelphia, PA
Status: Offline
Reply With Quote
Apr 30, 2008, 09:39 PM
 
I assume that you are putting this in the document root? You have to put it in the cgi-bin (CGI-Executables locally) directory.
     
Mac Enthusiast
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
Apr 30, 2008, 10:49 PM
 
Originally Posted by larkost View Post
I assume that you are putting this in the document root? You have to put it in the cgi-bin (CGI-Executables locally) directory.
There was a spot in the second part that said if I uncomment the line:
Code:
# AddHandler cgi-script .cgi
in my httpd.conf file, I could run a CGI script from anywhere. But even when the script is in the CGI-Executables folder it still just displays the code instead of interpreting it. Thanks
     
Moderator
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Apr 30, 2008, 11:07 PM
 
Just to check: The file is named <something>.cgi, right?
Chuck
___
"If you mean time-traveling bunnies, then yes."
     
Mac Enthusiast
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
Apr 30, 2008, 11:35 PM
 
It's saying I do not have permission to open the file now, even after "chmod 755". Yes it is a .cgi extension. I also tried the .pl extension and it just writes the code out, instead of interpreting. Thanks!
     
   
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 05:45 PM.
All contents of these forums © 1995-2008 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.7.1 © 2000-2008, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.2.0 RC8