Knowledge Base
MilesWeb / Web Hosting FAQ

{Introduction} – Perl Script Basics

Approx. read time : 3 min

This article explains the basic and important information that is needed to run Perl scripts on MilesWeb hosting server.

# Permission needed to set up Perl script files

The correct permission that is needed for Perl script files depends on the script’s particular function :

1. For Perl script files that are publicly accessible through the web, set the file permission to 755 (i.e. read, write and execute permissions for the user. Also, read and execute permission for the group and world.) There is no need to give the world write permission to the Perl script.

2. For Perl script files that you only run on the command line, set the file permission to 700 (i.e. read, write and execute permissions for the user but no permission for the group and world.)

# File extensions that can be used for Perl Script files

Perl script files have a .pl or .cgi extension. However, similar to file permission, the file extension also depends on the script’s particular function :

1. For the Perl script files that generate web output accessible to the public, you should use .cgi extension.

2. For the Perl script files that you only run from the command line and script files which do not generate web output, you should use the .pl extension.

# Find out Perl version using the command :

To determine the Perl version that is installed on your server, type the following command :

perl -v

# Path to the Perl executable :

For MilesWeb Hosting servers, the absolute path to the Perl executable is /usr/bin/perl. The default path is /usr/bin directory, that’s why generally you don’t need to include the full path when you run Perl scripts from the command line. Type the following command and replace, the filename with the name of your script file :

perl filename

# FTP transfer mode for Perl scripts :

Whenever you use FTP to upload Perl scripts to your site, make sure that you always use ASCII mode. If you upload scripts in binary mode, they don’t work and you receive an “Internal Server Error: Premature End of Script Headers” message (500 Internal Server Error) when you view the page.

View the official online Perl documentation at : http://www.perl.org/docs.html

Also Read :

1)How can I install Perl module in cPanel?

Sonam Wagh
With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.
Need help? We’re always here for you.