If you have basic understanding of apache, then this article is highly recommended for setup:
http://httpd.apache.org/docs/1.3/howto/cgi.html
I did setup this in my mac/OSx, was not easy to find info on web, hence I am briefing out the flow:
1) uncomment "LoadModule cgi_module libexec/apache2/mod_cgi.so" ( for me it exists in httpd.conf )
2) edit virtual hosts file to look like this: ( for mac, it is in httpd-vhosts.conf )
Options Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
NOTE: "/www" is where my project resides
"ExecCGI" is the option that has to be there
3) Below the directory closing, add this line: ( for mac, it is in httpd-vhosts.conf )
AddHandler cgi-script cgi py
4) Restart apache: "sudo apachectl restart"
Now running your project should give "End of script output before headers" error in error log and 500 internal server error on web.
-> Fix for this (add the below lines on top of your index file, which is referred in first and foremost call) :
#!/usr/local/bin/python
print "Content-Type: text/html"
print
print "Hey! There? "
NOTE: Make sure you don't miss out "#!/usr/local/bin/python" as it tells apache using which environment this file is to be executed.
Other pointers are: You have to do similar stuff on the parallel lines for setting up perl or any other CGI scripts.
Also, This sets up the basic CGI mode for python; while there are some other mods are also available like "mod_python" or "fastCGI".
http://httpd.apache.org/docs/1.3/howto/cgi.html
I did setup this in my mac/OSx, was not easy to find info on web, hence I am briefing out the flow:
1) uncomment "LoadModule cgi_module libexec/apache2/mod_cgi.so" ( for me it exists in httpd.conf )
2) edit virtual hosts file to look like this: ( for mac, it is in httpd-vhosts.conf )
Options Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
NOTE: "/www" is where my project resides
"ExecCGI" is the option that has to be there
3) Below the directory closing, add this line: ( for mac, it is in httpd-vhosts.conf )
AddHandler cgi-script cgi py
4) Restart apache: "sudo apachectl restart"
Now running your project should give "End of script output before headers" error in error log and 500 internal server error on web.
-> Fix for this (add the below lines on top of your index file, which is referred in first and foremost call) :
#!/usr/local/bin/python
print "Content-Type: text/html"
print "Hey! There? "
NOTE: Make sure you don't miss out "#!/usr/local/bin/python" as it tells apache using which environment this file is to be executed.
Other pointers are: You have to do similar stuff on the parallel lines for setting up perl or any other CGI scripts.
Also, This sets up the basic CGI mode for python; while there are some other mods are also available like "mod_python" or "fastCGI".
Comments
Post a Comment