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
@pplejaxkz
Senior User
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
Apr 30, 2008, 10: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!
     
larkost
Mac Elite
Join Date: Oct 1999
Location: San Jose, Ca
Status: Offline
Reply With Quote
Apr 30, 2008, 10: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.
     
@pplejaxkz  (op)
Senior User
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
Apr 30, 2008, 11: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
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
May 1, 2008, 12:07 AM
 
Just to check: The file is named <something>.cgi, right?
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
@pplejaxkz  (op)
Senior User
Join Date: Sep 2007
Location: NY
Status: Offline
Reply With Quote
May 1, 2008, 12:35 AM
 
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!
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 04:26 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,