How do I use Perl CGI scripts?
Our Web hosting service allows you to use CGI scripts created in the Perl programming language. We currently use Perl version 5.24.1 or 5.24.1 (depending on which server your account is on).
On this page:
- Use the correct path
- Publish using text (ASCII) mode in your FTP program
- Put the script in the cgi-bin directory
- Make the script executable
- Use the Script Checker
- Test the script
- Help! I see an "Internal Server Error"!
Use the correct path
First of all, be sure the first line of your Perl script begins with this line:
This is the "path" to the Perl program on our servers.
If you're using a script created by others, or you've been reading tutorials and you know how to set Perl options, there may also be a space followed by hyphens and other characters at the end of the line, such as:
#!/usr/bin/perl -w #!/usr/bin/perl -wT #!/usr/bin/perl -w -T
These are also okay, as long as the first part of the line is:
... followed by a space before the first hyphen.
Publish using text (ASCII) mode in your FTP program
Use your FTP program to upload the script file in text mode (sometimes called "ASCII mode"), not "binary" mode. Although text mode is the default for most FTP programs, your Perl script may not work if it's accidentally uploaded using binary mode, so it's wise to check.
Put the script in the cgi-bin directory
When you upload the script, place it in a directory (folder) named cgi-bin using your FTP program. You will need to create this directory the first time you upload a script.
(Advanced users can make other directories run scripts like the "cgi-bin" directory; see our "Making Additional Directories Executable" page for more information.)
Make the script executable
Set the file permissions to make your script "executable" after uploading (you'll sometimes see this process referred to as making the script permissions "mode 0755" or "mode 0700").
Your FTP program documentation should explain how to create directories, transfer a file in ASCII mode, and change the permissions of a file you've uploaded.
Use the Script Checker
You can use our Script Checker to verify that the script was uploaded properly. The page also gives you a quick way to make the file executable if you prefer to do that on the Web, rather than using your FTP program.
Test the script
Once your Perl script is installed, you'll access it as:
... where "script.name" is the actual name of your script.
If you have trouble, we have a separate page about debugging Perl scripts that you'll probably find useful.
Help! I see an "Internal Server Error"!
An "internal server error" means your script somehow isn't sending normal output to the Web server. The first thing to do is use our CGI Script Checker, which will verify that the script has the correct path and that it was uploaded in text mode. Always try the Script Checker first if you have trouble.
If the Script Checker says the script is okay, there is probably a bug or "typo" in the script you have uploaded. In that case, see our Perl debugging page for more information.
Copyright © 2000-2019 Tiger Technologies LLC