Knowledgebase
Knowledgebase
How to use CGI with Linux hosting accounts?
Posted by Tim Botherway on 23 May 2017 11:59 AM

Note: To use CGI (Common Gateway Interface) you should have enabled this at the time of ordering, or later through the 'Upgrade Centre', 'Add Application'. Alternatively drop a line to us at support@openhost.co.nz and we can do it for you. You should also consider 'Perl' and SSI (server-side includes).

Step 1: You should upload your cgi files to /cgi-bin and then access them through http://yourdomain.co.nz/cgi-bin/file.cgi



Step 2: Once your files are in place, it is imperative that you ensure the correct access permissions are in place.

  1. Do this by logging on to your hosting account and clicking on the "File Manger" icon.
  2. Select your cgi-bin folder
  3. click on the drop down button and Click on Change Permissions

 

Step 3: Change the permissions to the following.

 

Step 4: You can then access this test by using a web browser and viewing it as follows: http://yourdomain.co.nz/cgi-bin/test.pl

 

Note: You can use the script below to test your cgi scripts.

#! /usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body><h1>Hello World!";
print "</h1></body></html>\n";

Create a new document test.pl under cgi-bin. Now copy and paste this script in this document. Make sure you have assigned it the right permission as mentioned above. Also make sure CGI and Perl Support is enable.

 

(1 vote(s))
Helpful
Not helpful

Comments (0)