I cannot configure Apache Server to run CGI script written in python. I have searched the net and I have add all the information in "httpd.conf" file located at "C:\wamp\bin\apache\Apache2.2.17\conf" the details of modifications are;
<Directory />
Options FollowSymLinks +ExecCGI
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "C:\wamp\bin\apache\Apache2.2.17\cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddHandler cgi-script .cgi .py
I have added above mentioned settings in "httpd.conf" file located at "C:\wamp\bin\apache\Apache2.2.17\conf" and restarted the wamp server.
When ever I try to run my python CGI script browser just prints my code no error message. the link i am using is; http://localhost/cgi-bin/first_cgi_script.py
My code is;
#!c:\Python27\python.exe -u
import time
def printHeader( title ):
print """Content-type: text/html
<?xml version = "1.0" encoding = "UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head><title>%s</title></head>
<body>""" % title
printHeader( "Current date and time" )
print time.ctime( time.time() )
print "</body></html>"
Help is required thanks.