Hi, friends!
My site is: apiapi.heliohost.org
My server, I use is: johnny.heliohost.org
I want to run a simple Python CGI script
Reading this topic (https://www.helionet.org/index/topic/29035-basic-python-script-500-internal-server-erorr/?hl=python), I decide open new one because it is not work in my case.
1) I create a file with simple code (tacked from link below). Using Notepad, save it as file with .cgi extension (actually I tried .py extension to) with UTF-8 encoding (actually I tried UTF-8 without BOM | ANSI encoding to).
Code I used:
#!/usr/bin/python3.6
print("Content-Type: text/html\n\n")
print("Hello")
======= also try =======
#!/usr/bin/python3
print("Content-Type: text/html")
print
print("Hello")
======= also try =======
#!/usr/bin/python3
print "Content-Type: text/html"
print
print "Hello"
======= also try =======
#!/usr/bin/env python
print "Content-Type: text/html"
print
print """\
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
"""
2) Using cPanel --> File Manager I was upload my file into /public_html/cgi-bin/ directory
3) I create a .htaccess file with content
AddHandler python-program .py
and upload it into /public_html/cgi-bin/ directory (actually I attempt to run my script with/without it file)
4) Using cPanel --> Apache Handlers I was Create an Apache Handler. I Fill next fields respectively:
Handler: python-program
Extension(s): .py
5) Using my browser (chrome | IE) I was try to run my script by link: apiapi.heliohost.org/cgi-bin/hello.cgi
500 server error was occupied
If my file extension is .py - just source code is shown as result
5) Also I try to fetch my script recuvest thru html-page:
<html>
<head>
<title>script</title>
</head>
<body bgcolor="black" text="#FF9933" link="blue" vlink="purple" alink="red">
<form action="http://apiapi.heliohost.org/cgi-bin/hello.cgi">Enter:
<input type=submit value=Go>
</form>
</body>
</html>
Result always is the same
I do not know what to do...
Dear moderators, can You, please add some Wiki-page with step-by-step instruction with content describes simple Python CGI script performing.
Tell my please, were can I find error log file to debug my CGI scripts
Tank You so-so much for Your suggestions