2.20.17. Perl or Python script does not work
Perl and Python scripts (2.7, 3.3 and 3.6 are supported) can be run as CGI applications.
If you get an error while trying to execute the script "500 Internal server error", make sure the following conditions are met:
- The access rights to the directory where the script is placed must be
- The script permissions must be
- There should be no special characters after the path to the interpreter. Line feed must be in UNIX format -
\nand not in Windows format -
- At the beginning of the file, an interpreter must be specified that will process the script.
- If the script is supposed to output something to the browser, at the beginning of the script you need to insert a line that displays the title
Content-Type: text/htmland one blank line.
- There must be an empty line at the end of the file.
index.pyas an index file, you must either rename it to
index.cgior add to .htaccess directive
Sample Perl script
Sample Python 2 Script
#!/usr/bin/python print "Content-Type: text/html\n\n" msg = "Hello, World!" print """%s""" % msg
Sample Python 3 Script
#!/usr/bin/python3 print("Content-Type: text/html\n\n") msg = "Hello, World!" print("""%s""" % msg)