Question:
what do i use to run a .pl file?
Carlo R
2008-05-15 10:37:23 UTC
i'm using windows and only upload files to a webhosting account. what do i need to be able to run .pl files? do i need an application for this? thanks
Three answers:
DaveE
2008-05-15 11:18:14 UTC
First off:

as per shadow3dcaster's comment, DO NOT CHMOD 777. Never, ever, ever chmod 777, unless you really, really mean it. Instead, use chmod 755.



Back to the question...



If you need to run a .pl file (that's Perl) you need to make sure that your ISP allows you to do that. If they only allow flat content, you may not be able to run it at all.



If they allow dynamic content, and allow Perl, you'll need to make sure that the path is correct in your perl file. The first line of the Perl file will then look something like this:



#!/usr/bin/perl



In this case, the path for perl is /usr/bin. If you don't know the path, and you still can't get it to work, then try changing the first line to:



#!perl



That will assume (hopefully correctly) that the path is already set up by defult, and is in the webserver's path.



Now, on to permissions (and chmod).



The webserver may or may not know what to do with Perl files. If it knows what to do (IE if your ISP is smart about the files you upload AND allows you to upload them, which is unusual), then you have no need to change the permissions at all. However, chances are you'll need to set the permissions correctly.



Depending on how you upload files to your ISP, they may already have a way for you to do this built into their interface. If so, you want the file to be executable-- probably world executable, but possibly also self and group executable as well.



If you have to do it manually, you'll need to log on to the ISP's server via a command prompt, and change it that way, using chmod. You can use something like PuTTY (free terminal program for windows) to connect to your ISP's server, using your username and password.



Once you log in, you'll need to be in the directory that the file was uplaoded to, and you'll need to change the permissions of the file using chmod. For starters, try "chmod 755 myfile.pl".



A bit about chmod:



That number 755? It's a magical octal number. Each digit has significance. The 1st digit means "What can the owner do with this file?" The 2nd digit means "What can people in the owner's group do with this file?" And the 3rd means "What can anyone on this server do with this file?" The possibilities for each digit are 0-7, which are all the combinations of "read", "write", and "execute".



0 = Can't do anything

1 = Can't read the file, can't write to the file, CAN execute the file.

2 = Can't read the file, CAN write to the file, can't execute the file

3 = Can't read the file, CAN write to the file, CAN execute the file

4 = CAN read the file, can't write to the file, can't execute the file.

5 = CAN read the file, can't write to the file, CAN execute the file

6 = CAN read the file, CAN write to the file, can't execute the file

7 = CAN do anything to the file!



So if you ever chmod anything with the last digit of 7, 6, 3, or 2, that's dangerous, because anyone else on the server can choose to overwrite the contents of your file! And what's more, they may be able to make it to malicious things, which may trigger when you decide to run your file without checking it. So be very careful with chmods!



DaveE
anonymous
2008-05-15 17:50:13 UTC
You need command line access to the webserver to run the application (if it is an application).



First, download Putty and install it.

Put the URL of the Host (like http://www.myserver.com or an ip address).

Then login with your username and password.

Upload the file to your host.

go to the file (naviagte using unix commands) and CHMOD it using putty or an ftp client to 777 so you can execute the file.

then simply type the name of the file and press enter to execute the script.



If you don't understand any of that then you need to learn more about unix.
AibreanStudio
2008-05-15 17:48:14 UTC
That is a perl extension and you can open it with a basic text editor (like notepad).



Typical directory on the host:

#!/usr/local/bin/perl


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...