Home: Perl Programming Help: Beginner:
Cannot execute a new script



Negrazo49
Novice

Mar 8, 2016, 12:11 PM


Views: 2607
Cannot execute a new script

Hello everyone:
I am trying to run the mainmenu.pl script as
localhost:80/taxis/mainmenu.pl

And i am receiving this option:

Opening mainmenu.pl
You have choosen to open: mainmenu.pl bla bla bla
What Firefox should do wit this file?

Opening with perl? or
Saving the file?

The question is what am i doing wrong?

Any help will be really appreciated.
Thanks a lot.


Zhris
Enthusiast

Mar 8, 2016, 5:12 PM


Views: 2566
Re: [Negrazo49] Cannot execute a new script

Make sure the user running the script has execute permission.

Check the shebang line (first line) in the script points at your Perl interpreter.

Also check the response header is valid.

Chris


(This post was edited by Zhris on Mar 8, 2016, 5:21 PM)


Laurent_R
Veteran / Moderator

Mar 9, 2016, 3:10 AM


Views: 2498
Re: [Negrazo49] Cannot execute a new script

How are you launching this? I mean, from which application?


Negrazo49
Novice

Mar 9, 2016, 5:48 AM


Views: 2482
Re: [Zhris] Cannot execute a new script

Thank you Zhris for your answer.
I have permission to execute, the interpreter is in /usr/bin what i have to check is the envvar PATH. May be this is the problem.


Negrazo49
Novice

Mar 9, 2016, 5:50 AM


Views: 2481
Re: [Laurent_R] Cannot execute a new script

Hello Laurent.
I am using a browser, especifically Mozilla Firefox,

Http://localhost:80/taxis/indice.pl

What am i doing wrong?


Negrazo49
Novice

Mar 9, 2016, 5:56 AM


Views: 2479
Re: [Negrazo49] Cannot execute a new script

The PATH includes /usr/bin , so this is not the problem.
I will keep searching.

I thank you guys for your help.
Negrazo49


FishMonger
Veteran / Moderator

Mar 9, 2016, 9:38 AM


Views: 2467
Re: [Negrazo49] Cannot execute a new script

Do you have a web server such as apache installed on your system? If you do, then it's not configured correctly to execute cgi scripts. If you don't have a web server installed, then the browser is not going to know what to do with the script and won;t be able to execute it.


Zhris
Enthusiast

Mar 9, 2016, 5:32 PM


Views: 2457
Re: [Negrazo49] Cannot execute a new script

If the execute permission is fine and you still get the download dialog then I suspect what Fishmonger has pointed out, that your server might not be configured properly to execute cgi scripts ( http://httpd.apache.org/docs/current/howto/cgi.html ). If you didn't have a server installed at all, you wouldn't have gotten as far as you have. I mentioned you should also check the response headers because if your script prints a download or unrecognized content type, then it will likely force download, but this of course assumes your script executed successfully.

Chris


(This post was edited by Zhris on Mar 9, 2016, 5:34 PM)


Negrazo49
Novice

Mar 10, 2016, 10:21 AM


Views: 2435
Re: [Zhris] Cannot execute a new script

Dear Zhris and fishMonger, i saw your replies and everything you mention is fine. What i think is that Apache2 is not configured properly, i agree totally with you, and i am working on that.
I will keep you posted.

Thanks any way.

Negrazo49