Perl and Python scripts Print

  • 9

These scripts must have 755 permissions.

Perl = .pl
Python = .py

Example perl script:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test</title>";
print "</head><body>";
print "<p>Test page using Perl</p>";
print "</body></html>";

Example python script:

#!/usr/bin/python
print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test</title>";
print "</head><body>";
print "<p>Test page using Python</p>";
print "</body></html>";

Activate Python:

Please note that you have to add a line in the .htaccess file to use Python.

The recommended directive is:

Addhandler cgi-script .py .pl .cgi

(This directive covers Perl, Python and CGI files.)

Getting a 500 Internal Server Error?

If you are getting a 500 Internal Server Error, it is most likely caused by the lack of execute permissions. Check to make sure the your Perl or Python script file has permissions of 755.

Disclaimer:

Please note that these scripts are only examples, and we cannot guarantee that these scripts will work, nor can we assist with custom configurations of such scripts.


Was this answer helpful?

« Back