Page 1 of 1


PostPosted: 29. April 2017 08:39
by shyam
import mysql.connnector
import cgi,cgitb
cursor.execute("select version()")
print("database version %s" % data)
print("<a href="#">home</a>")
this is my code when i run this with i am getting the error as:-
Server error!

The server encountered an internal error and was unable to complete your request.

Error message:
couldn't create child process: 720002:

If you think this is a server error, please contact the webmaster.

Error 500

Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9

Re: error

PostPosted: 29. April 2017 23:53
by Nobbie
Python is not part of Xampp, i dont think you will get Python support in the Xampp Forum.

Re: error

PostPosted: 30. April 2017 06:02
by gsmith
While I understand the reasoning for Nobbie's answer above, I see this as more of supporting Apache rather than Python so I'm game.

In xampp\apache\conf\httpd.conf find the line similar to this

AddHandler cgi-script .cgi .pl .asp

add .py to the end of it, save and restart Apache.

If there is an error in your code (I don't read python) it will still bounce, but if the code is correct, it will work.

Re: error

PostPosted: 30. April 2017 12:39
by Nobbie
gsmith wrote:AddHandler cgi-script .cgi .pl .asp

add .py to the end of it, save and restart Apache.

I am pretty sure that this does not solve the issue, a missing CGI handler for .py would simply result in MIME Type "text", what means that Apache would deliver the module as simple text, i.e. the server would show the python code instead of executing it. I gave it a try on my Linux Xampp and it behaves exactly as expected.

Anyway, there *should* be an error message in error_log, which can give a clue what is going wrong. And it would be helpfull to know, where this script is stored (full pathname) and how it is called in the browser (full URL). Due to an ScriptAlias Clause for cgi-bin, we might solve it in the Xampp universum. If it is a Python problem, we cannot solve it here.

P.S.: An extremely strange message is "couldn't create child process: 720002:", as you told us that you called that script "". Where is "" coming from????

Re: error

PostPosted: 01. May 2017 00:47
by gsmith
True, just prints out the script's code as plain text.
Not a ScriptAlias'd directory or doesn't have ExecCGI turn on for said directory 403s.

Couldn't create child process is what you get when the shebang is incorrect.

Re: error

PostPosted: 01. May 2017 09:37
by Nobbie
gsmith wrote:Couldn't create child process is what you get when the shebang is incorrect.

Not only, on Linux for example you get if the file has wrong permissions (i actually struggled with that). You also get if you have ScriptAlias defined plus ExecCGI, the system then trys to run CGI via CGI (twice). This error has been a long time in the Xampp configuration (or it is still present), but i dont know if we are dealing with a Xampp installation?! Finally, what is this

Anyway, i succeded to run that Python Script without Apache Error, but it still does not run correctly as there are lots of syntax (Python) errors in that script, most obvious for example method "connector" with 3 n ("connnector").