How to test CGI is working with a ‘Hello World’ script

How to get CGI working on Plesk 11

Running CGi and Perl scripts is not as straightforward as PHP, so in order to get your CGI working, ensure to confirm the following steps. Once the file in in the correct location, and the file system permissions are correct you will be good to go.

1) Ensure Perl-CGI is installed on the server. If you host with us, this is already done for you.

# yum install perl-CGI

2) Ensure Perl/CGI is enabled for your domain name in your Plesk panel. Find the domain name in the Plesk panel and look at the ‘Website Sripting and Security’ section.

3) Create a file named ‘hello.cgi’ with the following contents:

print("Content-type: text/plain\n");
print("Hello World!\n");

4) Ensure your file is uploaded to /cgi-bin and not /httpdocs/cgi-bin

5) Ensure your file permissions on the file are 755, you can set this in your FTP application or File Manager

6) You can now execute the file as such:

Hello World!

Was this helpful?