Now that you've installed 2.6 of Python and support 2.6 of ERIC4, you don't want to reinstall 2.5来 to continue configuring Apache Mod_python.
Later, I found an article running Python as CGI in Apache in Windows, which tells you to run Python script in the CGI mode instead of Mod_python. And this python for Windows.
The procedure is:
Open httpd.conf, find "#ScriptInterpreterSource Registry", remove the previous comment # (add yourself if you can't find this line)
Find the "Options Indexes followsymlinks" and add "execcgi" to the back. (the "Indexes" best also can be removed, because if not removed, the directory does not index.html this file, it will display all the files under the directory list, so there is a security vulnerability problem. If indexes is removed and there is no index.html file, a Forbidden page will be displayed.
Find "AddHandler cgi-script. CGI" and Add. py at the back. If not, you can add your own "AddHandler cgi-script. Py"
Restart Apache (sometimes restart can cause Apache to die, so people in this situation can stop and start again)
And then create a test.py script,
Print "content-type:text/html"
Print ""
Print "print "Hello World"
Print "</body>
Running Http://localhost/test.py,Hello World Two words in a browser indicates that it is working correctly.
In addition, some error prompts are as follows:
No Scriptinterpretersource Registry is added, and a Internal Server error error occurs.
Without adding execcgi, you will receive 403 Forbidden you don ' t have permission to access/test.py on the this server.
Without adding AddHandler cgi-script. py, the content will be displayed in the text text format in the browser.
Note:
The intention of adding Scriptinterpretersource registry is to have Windows use Registry to find the place where Python is installed.
EXECCGI is to allow Python script to run under any directory, because Apache defaults to let CGI scripts run in the Cgi-bin directory. And I put test.py under Htdocs Run will appear 403 forbidden problem. So you need to add execcgi so that you can run it under Htdocs. py script. But excecgi will have a problem with security vulnerabilities. It would be safer to use fastcgi. But the premise is to need to install fastcgi.
CGI mode is slower than Mod_python mode. So there's a chance to try Mod_python mode on other computers later.