If you have some questions about the practical application of Python Installation notes, or you are a beginner in Python Installation notes, you can browse our article, I hope you will have some gains. The following is a detailed description of the article.
The following steps are some records of the configuration process. I hope it will be helpful to anyone who wants to use mod_python. Note the indentation of the test code.
1. Download a new version. Pay attention to apache and python versions)
2. Copy the package to a linux machine and execute Python Installation notes on the command line:
- tar -zxvf mod_python-3.3.1.tgz
- cd mod_python-3.3.1
- ./configure --with-apxs=/usr/local/apache/bin/apxs
Configure the apxs directory
- ./configure --with-python=/usr/bin/python2.5
Configure local python
- make
- make install
3. After compilation, mod_python.so will be generated in the apache/modules/directory, about 3 m.
4. Configure apache http. conf
- LoadModule python_module modules/mod_python.so
- <Directory "/usr/modpython">
Directories that can be accessed using apache
- #AddHandler mod_python .py
- SetHandler mod_python
- PythonHandler mod_python.publisher
- PythonDebug On
- </Directory>
5. Create a test. py file in the/usr/modpython/directory.
- #coding:gb2312
- def index(req):
- req.write("hello,world!")
- return
6. Run Python Installation notes. After apache startup is successful,