Gossamer Forum
Home : General : Perl Programming :

Running scripts

Quote Reply
Running scripts
I would like to be able to run a script and call it by just it's file, i.e. script rather than script.pl or script.cgi

My current host lets me run a script with either *.pl or *.cgi but without an extension, I can't - even when the mod is set to 755.

I know this is possible becuase I once had a host that let you run any script with any extension anywhere on the site.

I just hope that their is a way to get around server restrictions if any.
Quote Reply
Re: Running scripts In reply to
By setting the webserver to only execute .pl and .cgi programs, there is a slightly increased security.

On Unix, you don't need a file extention, and the first byte or bytes of a file tell the operating system what to do with it.

That's why you can run a perl program if you put #!/path/to/perl as the first line, but otherwise you have to type /path/to/perl program_name or program_name.pl

On Windows, the .pl will tell the OS to associate the file with perl, but you can override that.

Hope this helps.

Basically, you need to run a script by it's full name, and your ISP has decided the fullname includes a .pl or .cgi extension.