Prem asked this 1 year ago

Apache CGI Error: The system cannot find the file specified. couldn't spawn child process:

I'm trying to run the following "Hello world" Python cgi script

#!/usr/bin/env python

print "Content-Type: text/plain;charset=utf-8"

print """\
  <title>Python - Hello World</title>
Hello World


and gets "Internal Server Error

Apache error log shows the following error message

[cgi:error] [pid 10068:tid 1140] (9)Bad file descriptor: [client ::1:54696] AH01222: don't know how to spawn child process: C:/httpd-2.4.37-win64-VC15/Apache24/cgi-bin/

Am I missing something in .conf?

Best Answer by rijo 1 year ago

it looks like you are running Apache on windows because the error message say c:\httpd-2.4.37-win64-VC15 however your hashbang on the first line of the script is for linux/unix installation of Python


 #!/usr/bin/env python


#! c:/your/windows/python/install_directory



Prem 1 year ago

Thanks, for your quick response Rijo.!! 

It was really stupid of me. changed the first line to  #!C:\Python26\Python and it worked!!