Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get perl / cgi to work??

Status
Not open for further replies.

BigBadDave

Programmer
May 31, 2001
1,069
EU
I have this simple file print.cgi :

Code:
#!/usr/bin/perl

     print "this is print.cgi";

But I get a 500 error just for this!!

How do I make any cgi work? Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
If you are not using mod_perl, you have to send the Content-type HTTP header in all your CGi scripts.
The simplest script would look like this
#!/path/to/perl
print "Content-type: text/plain\n\n";
print "Hello world!"; //Daniel
 
first thing first !
do have perl instaled ?
what the server ? apache ? IIS ?
what your OS ? nix ? win32 ? others ?
and your test script should be like this
#!/path/to/perl -W
print "Content-type: text/html\n\n";
print &quot;<html>this is print.cgi</html>&quot;;
# end

---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
I tryed adding the header as well but it still dosn't work at all and I havn't got shell access to my server so I can't get any kind of error messages Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
Here is my server info:

Linux
Apache Version 1.3.24
Perl Version 5.006001
Perl Path /usr/bin/perl
PHP Version 4.2.1
Mysql Version 3.23.45
Sendmail Path /usr/sbin/sendmail Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
more info on mod_perl :

faq219-454


---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
NEVERSLEEP don't put that url that you have as it has logged me in as you!!

just write :

faq219-454

and it will automatically jump to the right FAQ Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
usaly putting the url the 'form retriever' place that faqxxx
well for thread it does.....

this thread452-293005 url)

see ! ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Hi mate,

What extension are you using for the script? Some servers are not configured to use .pl and some dont use .cgi, try to change the extension.

Also, what do the error logs say? They should give a very good account of what is happening.

If you have access to the httpd.conf then set the log level to debug as follows:

LogLevel Debug

If you post any errors here then we can help more.

Hope this helps Wullie

 
simple question have you changed the permission to the script to chmod 0755?
 
Hi Three things come to mind.

1. CHMOD 0755
2. Have you uploaded in Binary or Text format (should be text
3. Did you write the file in windows? Windows has been known to add windows end of line and screw up the file, even in notepad??

Try using DzSofts ( perleditor, it's free for the first 100 lines of code or so and would help you.

Kind Regards, Paul Benn

**** Never Giveup, keep trying, the answer is out there!!! ****
 
see the faqs under the 'FAQs' tab at the front page of the forum. There is one on the basics of CGI and another on common problems.

'Hang in there. It'll work. 'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top