不能太心急,磨刀不误砍柴功,不能一脑袋直接向目标上撞去。

初始状态:默认的WAMP配置
  1. LoadModule cgi_module modules/mod_cgi.so
动作:(httpd.conf中)
1,中(后面添加ExecCGI):
  1. Options Indexes FollowSymLinks ExecCGI
2,中:
  1.     # AddHandler allows you to map certain file extensions to "handlers":
  2.     # actions unrelated to filetype. These can be either built into the server
  3.     # or added with the Action directive (see below)
  4.     #
  5.     # To use CGI scripts outside of ScriptAliased directories:
  6.     # (You will also need to add "ExecCGI" to the "Options" directive.)
  7.     #
  8.     AddHandler cgi-script .cgi .py
3,编写的Python文件:(注意前三行,否则Internal Server Error

  1. #!D:\Python27\python.exe
  2. print "Content-type:text/html"
  3. print
  4. print "hello world"
10-05 06:43