We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

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 the error "500 Internal server error», Make sure the following conditions are met:

  1. The access rights to the directory where the script is located must be 750 or rwxr-x—.
  2. The script permissions must be 750 or rwxr-x—.
  3. There should be no special characters after the path to the interpreter. Line feed must be in UNIX format - \nand not in Windows format - \r\n.
  4. At the beginning of the file, an interpreter must be specified that will process the script.
  5. If the script should output something to the browser, at the beginning of the script you need to insert a line that displays the title Content-Type: text/html and one blank line.
  6. There must be an empty line at the end of the file.
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "Hello, World!";
print " ";
 
#!/usr/bin/python
print "Content-Type: text/html\n\n"
msg = "Hello, World!"
print """%s""" % msg
 
#!/usr/bin/python3
print("Content-Type: text/html\n\n")
msg = "Hello, World!"
print("""%s""" % msg)