CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
None of my cgi/pl scripts will run.

 



pdg
Novice

Sep 13, 2008, 12:57 PM

Post #1 of 16 (1192 views)
None of my cgi/pl scripts will run. Can't Post

I've been having a problem where absolutely none of the perl scripts I upload will run on my web server. I contacted my hosting service and they uploaded the following Hello World script to my cgi-bin which does work:


Code
#!/usr/bin/perl 
# Tell perl to send a html header.
# So your browser gets the output
# rather then <stdout>(command line
# on the server.)
print "Content-type: text/html\n\n";

# print your basic html tags.
# and the content of them.
print "<html><head><title>Hello World!! </title></head>\n";
print "<body><h1>Hello world</h1></body></html>\n";


I made a copy and saved it as "test.pl" when I hit save, as in putting the quotes around it makes it save as test.pl and not test.pl.txt.
I changed the output text to "Hey, this works!" instead of "Hello world".
I saved it, uploaded it via ftp, and changed the permissions to 755 (-rwxr-xr-x). This script won't work at all.
I've got several files uploaded. Only one works, it's saved as a .cgi extension, but I can't figure out what's allowing that one to work but none of my other ones.
Permissions on all of my files are set correctly. They've all go the "print "Content-type: text/html\n\n";" line in them. I'm uploading them all in ascii format, and they're all pointing to my /usr/bin/perl directory as they should.
Every file I've uploaded gives me a 500 Server Error Message.
Can anyone help me out?
Pender Design Group


KevinR
Veteran


Sep 13, 2008, 1:11 PM

Post #2 of 16 (1190 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

When you save the file as test.pl is it being saved in plain text or ASCII format? Besides that it sounds like you are doing everything correctly. Try uploading in binary instead of ASCII and see if that helps. Check the server error/cgi-error log for any information.
-------------------------------------------------


pdg
Novice

Sep 13, 2008, 1:21 PM

Post #3 of 16 (1188 views)
Re: [KevinR] None of my cgi/pl scripts will run. [In reply to] Can't Post

I'm using Free Script Editor to edit. It only gives me three options:
Save as text (all files)
Save HTML
Save RTF

When I Save As, I enter (for example) "test.pl" so it doesn't name the file test.pl.txt.

Uploading in binary didn't do anything. I'm still trying to figure out how to access the error log.
Pender Design Group


KevinR
Veteran


Sep 13, 2008, 1:25 PM

Post #4 of 16 (1187 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

select the "save as text" option then save the file as "test.pl". Hopefully that helps but I am doubtful. At this point I am not sure what the problem could be.
-------------------------------------------------


pdg
Novice

Sep 13, 2008, 1:53 PM

Post #5 of 16 (1183 views)
Re: [KevinR] None of my cgi/pl scripts will run. [In reply to] Can't Post

Dern. That's what I'm already doing.
There seems to be no rhyme or reason behind it.

For what it's worth, I started reading this site and writing scripts they use as examples. After my fourth or fifth one, they suddenly decided they didn't want to work anymore. All the scripts I previously wrote run just fine.
Pender Design Group


KevinR
Veteran


Sep 13, 2008, 2:37 PM

Post #6 of 16 (1177 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

I don't know what else to suggestion. Beginning Perl has been around for a very long time and there is nothing unusual in the example scripts. If no scripts will work on the site then something must have changed on the site. Make doubly-sure the path to perl is correct.
-------------------------------------------------


shawnhcorey
Enthusiast


Sep 13, 2008, 3:49 PM

Post #7 of 16 (1174 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post


In Reply To
I've got several files uploaded. Only one works, it's saved as a .cgi extension, but I can't figure out what's allowing that one to work but none of my other ones.


Some web servers are configured so that only executable files with the *.cgi extend will run. Check with your web server admin.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


pdg
Novice

Sep 13, 2008, 6:09 PM

Post #8 of 16 (1169 views)
Re: [shawnhcorey] None of my cgi/pl scripts will run. [In reply to] Can't Post

Good point, but the sample file they uploaded is a .pl file and the one I managed to get to work is a .cgi file so the server will run both.
Guess I need to delve deeper.
Pender Design Group


shawnhcorey
Enthusiast


Sep 13, 2008, 7:07 PM

Post #9 of 16 (1164 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post


In Reply To
Good point, but the sample file they uploaded is a .pl file and the one I managed to get to work is a .cgi file so the server will run both.
Guess I need to delve deeper.


I'm running Apache 2 and it's logs are in /var/log/apache2/error.log

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


pdg
Novice

Sep 13, 2008, 7:11 PM

Post #10 of 16 (1163 views)
Re: [shawnhcorey] None of my cgi/pl scripts will run. [In reply to] Can't Post

I don't even have a /var directory on my server. There is an /error_log directory though but the last error is recorded was way back in 2007.
Pender Design Group


sycoogtit
User

Sep 13, 2008, 7:59 PM

Post #11 of 16 (1159 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

No errors since 2007? Sweet! Smile

Can you run any of your scripts from the command line? How about adding


Code
use CGI::Carp qw/fatalsToBrowser/;


--
http://bunsooter.com


pdg
Novice

Sep 14, 2008, 5:03 AM

Post #12 of 16 (1139 views)
Re: [sycoogtit] None of my cgi/pl scripts will run. [In reply to] Can't Post

Okay, maybe I'm getting somewhere now.
I opened the "Hello World" file my hosting service uploaded to my server and saved it as "test.pl" and changed the output to something else. It does run from my hard drive, but won't run from my web server.
Like I said, I'm uploading them in ascii and setting the permissions to 755.
The

use CGI::Carp qw/fatalsToBrowser/;

Code
 line didn't do anything. 
Pender Design Group


sycoogtit
User

Sep 14, 2008, 7:43 AM

Post #13 of 16 (1133 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

Can you ssh or telnet to your web server? If so, you can try to run it from the command line on the server.

Any luck on those error logs? What kind of server do you have?

--
http://bunsooter.com


pdg
Novice

Sep 14, 2008, 7:45 AM

Post #14 of 16 (1132 views)
Re: [sycoogtit] None of my cgi/pl scripts will run. [In reply to] Can't Post

I'll have to get with them and find out if I can. I want to do some more testing first though with certain scripts I'm trying to get to run.
Nothing on the error logs. My last error log was in 2007 and I only started doing this scripting stuff a week ago.
It's a linux server. That's all I know.
Pender Design Group

(This post was edited by pdg on Sep 14, 2008, 7:46 AM)


sycoogtit
User

Sep 14, 2008, 8:02 AM

Post #15 of 16 (1129 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

Do you have anything at /path/to/site/statistics/logs?

--
http://bunsooter.com


KevinR
Veteran


Sep 14, 2008, 10:07 AM

Post #16 of 16 (1124 views)
Re: [pdg] None of my cgi/pl scripts will run. [In reply to] Can't Post

Ask your host to reset your account. Sounds like something is hosed up.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives