my perl script doesnot execute !

I have a script which works fine in my old UNIX web server. When In moved to NT I have a lot of problems. When I submit, I wait until I get the time out message from the browser ? Can you help please. Thanks

Wal
waleed072098Asked:
Who is Participating?
 
alamoConnect With a Mentor Commented:
Well, then I'll post an answer to close this question out.

Glad I could help!
0
 
alamoCommented:
First thing to try: an extremely simple one line script:

print "Content-Type: text/plain\n\nIt worked\n";

This will make sure your server is set up to run perl scripts properly. In NT on IIS you need to set up the registry script mappings so that .pl calls perl.

What kind of server? What version of perl? perlis or perl.exe?
0
 
waleed072098Author Commented:
To alamo
The registry script mappings is setup.
Server is  IIS3
Perl version is Perl5
Perl.exe

Thanks
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
waleed072098Author Commented:
To alamo
The registry script mappings is setup.
Server is  IIS3
Perl version is Perl5
Perl.exe

Thanks
0
 
alamoCommented:
Does the test script I posted work? If so, something about your script. (You probably knew this, but I wanted to double-check).

What does the script do? Does it call system or invoke any other processes?
0
 
waleed072098Author Commented:
Nothing happend. Still hanging until I got the time out message.

By the way what is "nIt" Is it N L T in lowercase ?
0
 
waleed072098Author Commented:
sorry it is like this .\n\n it worked. Ok but it still hanging like loading .
0
 
alamoCommented:
The n was the last part of \n, my one-liner was the equivalent of

print "Content-Type: text/plain\n\n";
print "It worked\n";

which is as simple as you can get.

So possibly your script mappings aren't working, if the simplest perl script won't run, yet doesn't give an error. On mu machine (an older version of IIS but I think the mapping is the same) the key is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Script Map
and the value and data is
".pl"="d:\programs\perl5\bin\perl.exe %s %s"

Obviously the path to perl will be different, but the %s %s after it is the critical thing.

How does this differ than yours?
0
 
alamoCommented:
Just saw your last post, hadn't seen it before I just posted it.

If you see \n in your test script, you are using single-quotes instead of double-quotes, use double quotes and the entire page should be
It worked
0
 
waleed072098Author Commented:
mine is like this
".pl"="c:\perl\perl5\bin\perl.exe"
I added the %s %s
and become like this
".pl"="c:\perl\perl5\bin\perl.exe %s %s"

and then I executed it opens the File Download Window

                              Open this file....
                              Save this fille...
0
 
waleed072098Author Commented:
mine is like this
".pl"="c:\perl\perl5\bin\perl.exe"
I added the %s %s
and become like this
".pl"="c:\perl\perl5\bin\perl.exe %s %s"

and then I executed it opens the File Download Window

                              Open this file....
                              Save this fille...
0
 
alamoCommented:
If you choose "Save this file" and look at the file, what is it?
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
waleed072098Author Commented:
Ok I did. It save my perl file which is

test.pl

and the content:

# ! /usr/local/bin/perl             <---------that's from unix not my actual perl path.
print "Content-Type: text/plain\n\nIt worked\n";
0
 
alamoCommented:
The server no longer recognizes .pl as a script, strange. Try stopping and restarting the server so it rereads the registry. Also make sure the directory the script is in is marked in the Internet Service Manager as an execute directory as well as read.
0
 
waleed072098Author Commented:
yes strange but at the command line, I can execute the test.pl just by typing the name of the file and return  w/o perl (i.e c:\test.pl ) so the computer understands the extension.

The script is under  c:\inetpub\wwwroot\cgi-bin

It is there  in the internet service manager

But should it be under scripts eventhough it is given the same thing ?
0
 
alamoCommented:
It doesn't need to be in scripts as long as intenet service manager shows cgi-bin as having both read and execute rights. You could try it in scripts just to see if anything is different.

The way IIS works, it needs the script-mappings in the registry rather than extension like you would use from the command line.
0
 
alamoCommented:
I did some testing, and it looks like it no longer sees .pl as a script type. One thing that occurred to me is when I posted

".pl"="c:\perl\perl5\bin\perl.exe %s %s"

I was using the format exported by regedit - and regedit adds double quotes to the .pl. If you added them on your system it would explain it. I just cehcked regedit and on my system .pl shows without quotes, "c:\perl\perl5\bin\perl.exe %s %s" shows with quotes. So maybe you should double check that entry. I think you're close.
0
 
waleed072098Author Commented:
Sorry It is not in double quotes. It is like this:

pl=c:\perl\perl5\bin\perl.exe %s %s

No quotes ata all.

Still not working
0
 
waleed072098Author Commented:
Sorry It is not in double quotes. It is like this:

pl=c:\perl\perl5\bin\perl.exe %s %s

No quotes ata all.

Still not working
0
 
alamoCommented:
Hi again waleed,

Maybe it was just a typo in what you posted, but it needs to be .pl (with the dot preceding it) not just pl

I have completely reconstucted your situation. Here's what I did:

1. I changed My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Script Map value for .pl to d:\programs\perl5\bin\perl.exe
I then had exactly the same problem you had originally - the server waited until timeout.

2. I then renamed the .pl key above to pl. After stopping and restarting the server, I then saw exactly what you are seing - it didn't recognize that it was a script at all, and gave me Save As window just like it is for you now.

3. I then renamed the above pl back to .pl and added %s %s to the end of the value, and after restarting the server it all worked for me.

That's why I think there's just a minor editing problem here - I can duplicate everything you are seeing happen by making changes to that key.
0
 
waleed072098Author Commented:
Hi alamo,
Sorry for bothering you again.
It is always .pl with a dot but I forget it when I post it.

Her is what I have
pl:REG_SZ : C:\perl\perl5\bin\perl.exe %s %s

Thanks again
0
 
alamoCommented:
Let's step back and make sure the server is seeing that entry - it seems to me it isn't but the entry looks fine to me.

Change the value back to its original, that is remove %s %s from the string. What should happen is the original problem - never responding and then timing out - should return. This will prove that it's seeing that entry in the registry.
0
 
waleed072098Author Commented:
I removed %s %s from the string. The result is no respond and thentimeout.

Waleed
0
 
alamoCommented:
Ok, that proves that it's seeing that entry, it considers your script a script, and is running perl.
 
When the %s %s is there, the fact that you get a Save dialog and when you save it you got a copy of your script shows that it's not seeing your script as a script, and isn't running perl.

That's what I don't understand. It makes no sense. I could understand it if you were running IIS4, but not on IIS3.

Let's try adding the %s %s back to the registry entry, then insert the following line into your test script at the top.

print "HTTP/1.0 200 OK\n";

It should make no difference, but...
0
 
waleed072098Author Commented:
Can you wait until tomorow morning. Actually, maybe it is ISS4.
I am not really sure if I upgrade it or not and I can't check it now. I have some lectures to attend the rest of the day. Do you mind waiting till tomorrow. Thanks alot.

Waleed
0
 
alamoCommented:
Sure, no problem! That would explain why things are a little different, they changed a lot in IIS4.
0
 
waleed072098Author Commented:
hello,
Good morning

I checked the server it is IIS 3 ver 4.0.
0
 
waleed072098Author Commented:
what the difference b/w 3 & 4. You recommend upgrading ?
0
 
waleed072098Author Commented:
what the difference b/w 3 & 4. You recommend upgrading ?
0
 
alamoCommented:
Hi waleed,

I don't have IIS4, so I don't know. I have read one big thing is it makes it easy to run multiple virtual sites (all with separate domain names) on a single IP address. The configuration is much different, it got so big they moved much of it out of the registry into a separate "metabase", and you must configure it from their dialogs. They also changed how scripts are called in some cases.

Did changing back to %s %s and adding the Status: line make a difference?
0
 
waleed072098Author Commented:
I removed the %s %s and it wait until timeout


What is the ststus: ?

I put it back it displays the download window.

Now it is like this:
pl:REG_SZ : C:\perl\perl5\bin\perl.exe %s %s

and it
0
 
waleed072098Author Commented:
sorry there id a dot before pl
0
 
alamoCommented:
Well,
pl:REG_SZ : C:\perl\perl5\bin\perl.exe %s %s
should be
pl:REG_SZ : C:\perl\perl5\bin\perl.exe %s %s
(with a dot) but you said before that was just an error in cutting and pasting, it was there in the registry.

The Status I was referring to was my last suggestion yesterday -
 Let's try adding the %s %s back to the registry entry, then insert the following line into your test script at the top.

print "HTTP/1.0 200 OK\n";

It should make no difference, but...
0
 
waleed072098Author Commented:
I removed the %s %s and it wait until timeout


What is the ststus: ?

I put it back it displays the download window.

Now it is like this:
pl:REG_SZ : C:\perl\perl5\bin\perl.exe %s %s

and it
0
 
waleed072098Author Commented:
You know what happend ? strange

When I clicked on the cgi from the html, it opend the download window
I chose to dowanload  but it did not downlaod the content of th file test.pl but the result which is "It worked".

And that was even before the addition of this line  [print "HTTP/1.0 200 OK\n";  ]
0
 
alamoCommented:
This is what I had expected when you originally got the Save As box - it shows the script is running but the headers are wrong, so the browser doesn't know what to do with it. This is progress!

The headers in the test program I gave you should be enough, but maybe for some reason IIS wants a status header- so the [print "HTTP/1.0 200 OK\n";  ] should help. If it still doesn't work, copy and paste the test script here again.

Once that works it's on to your *real* script.
0
 
waleed072098Author Commented:
This is the script

#! /usr/local/bin/perl
print "HTTP/1.0 200 OK\n";
print "Content-Type:text/plain\n\nIt worked\n";

It still doing the same. I removed the first line and tried again. It still doing the same thing.

0
 
waleed072098Author Commented:
This is the script

#! /usr/local/bin/perl
print "HTTP/1.0 200 OK\n";
print "Content-Type:text/plain\n\nIt worked\n";

It still doing the same. I removed the first line and tried again. It still doing the same thing.

0
 
waleed072098Author Commented:
This is the script

#! /usr/local/bin/perl
print "HTTP/1.0 200 OK\n";
print "Content-Type:text/plain\n\nIt worked\n";

It still doing the same. I removed the first line and tried again. It still doing the same thing.

0
 
alamoCommented:
There should be a space after the : before the t in the Content-type: text/plain line. Not sure if that will make a difference.

When the server doesn't recognize the Content-type, it might add one that causes the browser to open the Save box.
0
 
waleed072098Author Commented:
This is the script

#! /usr/local/bin/perl
print "HTTP/1.0 200 OK\n";
print "Content-Type:text/plain\n\nIt worked\n";

It still doing the same. I removed the first line and tried again. It still doing the same thing.

0
 
waleed072098Author Commented:
It tried id didn't work same as before. But I TRIED TO RUN IT USING NETSCAPE 4
and guess what it worked !

I tried to run my script using NETSCAPE 4 and it also worked.

What is wrong with Internet explorer (Navigator ver. 4) my friend ? It still open the save as window .
0
 
alamoCommented:
That's strange... text/plain should be a perfectly valid, Netscape loves it and IE accepts it when the file ends in .txt. I think this is a case of IE not paying complete attention to the MIME type and letting the file extension confuse it.

Sorry about that - I  thought the test script was so simple that it couldn't fail and it did anyway. Change the Content-type from text/plain to text/html and it will work. This will confirm that the server is set up properly.
0
 
waleed072098Author Commented:
Ok, I'll do that but tomorrow morning. It's time for class my friend. Thanks
0
 
waleed072098Author Commented:

Ok, it worked now in both (netscape + IE). I thank you very much.
I appreciat it.
0
 
alamoCommented:
Great! Does your script from Unix work also?
0
 
waleed072098Author Commented:
yes. with yor help !
0
 
waleed072098Author Commented:

I wish I had more points. GOOD LUCK !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.