1.找到httpd.conf文件(D:\wamp64\bin\apache\apache2.4.23\conf\httpd.conf)
2.将 LoadModule cgi_module modules/mod_cgi.so 开启
3.<Directory "${INSTALL_DIR}/www/cgi-bin">
AllowOverride None
Options None
Require all granted
Options Indexes FollowSymLinks ExecCGI(加入这条)
</Directory>
4.在<IfModule mime_module>中加入 AddHandler cgi-script .cgi .py
5.
编写的Python文件:(注意前三行,否则Internal Server Error)
- #!D:\Python27\python.exe //这条是重点
- print "Content-type:text/html"
- print
- print "hello world"