|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
Join Date: Dec 2000
Posts: 25
|
I hope somome can help.
I am running PWS on a WIn2k PC and have installed PHP. I have configured scripting in IIS to accept .pl. and .cgi commands. When I run the perl scripts I get it to work ok, but I also get a load of stuff that is supposed not to be there by the # command. If you goto the following urls you will see what happens:- http://scott-lewis.d2g.com/cgi-bin/test-perl.pl or http://scott-lewis.d2g.com/test/ (enter an e-mail address and you will see what happens) Any ideas, advice or maybe web sites that can help. -- Scott http://www.toptravelsites.net http://www.myeyes-youreyes.co.uk |
|
|
|
|
|
#2 |
|
Member (13 bit)
|
Moved to programming for ya, hopefully there'll be someone a bit more qualified to help ya that'll read it in here.
Xayd |
|
|
|
|
|
#3 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
Can you post the source of the first PERL script (or both for that matter)?
__________________
Paul M. Victorey ------------------ I am not responsible for any problems that may arise as a result of following my advice. This includes, but is not limited to, computer failure, loss of data, nuclear war, famine, boils, no clean laundry, your daughter running off with a biker gang, or armageddon. Take my advice at your own risk. |
|
|
|
|
|
#4 | ||||
|
Member (5 bit)
Join Date: Dec 2000
Posts: 25
|
Here is the tst-perl.pl script:-
#!/usr/bin/perl ############################################## # test-perl.pl # Matt Kynaston # Say hi and print environment variables # # Lines that start with a hash mark (#), like this one, are # comments, and are ignored by the Perl interpreter. # # The first line of this script tells the operating system # where to look for the perl program. The Xitami browser # ignores it, and looks at your computers PATH instead. # Almost all Unix systems have it in /usr/bin/perl, but # check with your host's help pages if nothing else works. ############################################## # The following line is essential - it lets the server know # that what follows is an html document print "Content-type: text/html\n\n"; ############################################## # Now start printing the HTML document itself print " print ""; print ""; print " Hello from Perl!";############################################## # Now print a block of text - all the way to EOF marker print << "EOF"; Congratulations! Perl is working The following table lists environment Upload this script to your cgi-bin (make sure
From it you should be able to work out the
exit; |
||||
|
|
|
|
|
#5 |
|
Member (5 bit)
Join Date: Dec 2000
Posts: 25
|
Soory - the forum just seems to run the script. If you nead me to e-mail let me know.
Scott |
|
|
|
|
|
#6 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
It looks like the script appeared fine?
I'd say offhand the fault lies with the interpreter and not the script. However, one thing -- what kind of machine are you running the script on, and what kind of machine did you create it on? Because, the newline character is different on different machines -- so if you made it on a PC and FTPd it onto a UNIX system using binary mode transfer, the interpreter might not see any newlines in the entire script. Because of that, it would ignore the comments because comments must being with the # as the first character of the new line (I think, it's been a while). Use ASCII mode to FTP your file in, that should work to convert the line breaks. [Edited by Paul Victorey on 04-22-2001 at 12:21 PM] |
|
|
|
|
|
#7 |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Generally whenever you get #comments from a perl script it is generally because the script is not executable. In Linux, you would do a chmod to fix this.
The first line of your script says /usr/bin/perl which would be the correct path in Linux. I really have never used perl for Windows but I would think that you need to change this line to whatever your path to perl on the II-s server is. It should be something like c:/path to perl.exe. Also there should be two lines starting your script like this: print "HTTP/1.0 200 OK\n"; print "Content-type: text/html\n\n"; I only saw one. |
|
|
|
|
|
#8 |
|
Member (12 bit)
Join Date: Mar 1999
Location: MN or WI
Posts: 3,017
|
You don't truly need the HTTP status; the server will generate this for you if it is omitted (unless you use nph scripts).
I agree that you need to set the path -- in fact it definately appears that the script is not executing at all, but is simply being viewed. Make sure you have (if it's a unix type system) execute permission for all (chmod 755 should work for you), and make sure the perl interpreter is at the correct location. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|