一.环境说明
1.系统环境
CentOS release 5.4 (Final)
2.软件版本
Apache 2.2.3
Python 2.6.6
mod_python 3.3.1
二.安装Apache
1.如果使用Apache源码进行安装,请到http://httpd.apache.org下载所需版本。
安装过程略。
2.如果使用系统自带的Apache,则需要查看系统是否安装httpd-devel包。操作如下:
# yum list httpd-devel
如果已安装,则跳过以下步骤:
# yum search httpd-devel
# yum install httpd-devel.x86_64
三.安装Python
# tar -jxvf Python-2.6.6.tar.bz2
# cd Python-2.6.6
# CCSHARED="-fPIC" ./configure
# vi Makefile
如果CC= gcc -pthread,则修改为CC= gcc -pthread -fPIC
# make
# make install
注意:Python的安装目录是/usr/local/lib/python2.6/
四.安装mod_python
# tar -xvf mod_python-3.3.1.tar
# cd mod_python-3.3.1
# whereis apxs
apxs: /usr/sbin/apxs /usr/share/man/man8/apxs.8.gz
# ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
# make
# make install(/usr/local/lib/python2.6/site-packages/mod_python)
注意:如果没有源码包请到http://www.modpython.org/下载
五.配置Apache
# cd src
# cp mod_python.so /etc/httpd/modules/
# cd /etc/httpd/conf
# vi httpd.conf
添加LoadModule python_module modules/mod_python.so
1.系统环境
CentOS release 5.4 (Final)
2.软件版本
Apache 2.2.3
Python 2.6.6
mod_python 3.3.1
二.安装Apache
1.如果使用Apache源码进行安装,请到http://httpd.apache.org下载所需版本。
安装过程略。
2.如果使用系统自带的Apache,则需要查看系统是否安装httpd-devel包。操作如下:
# yum list httpd-devel
如果已安装,则跳过以下步骤:
# yum search httpd-devel
# yum install httpd-devel.x86_64
三.安装Python
# tar -jxvf Python-2.6.6.tar.bz2
# cd Python-2.6.6
# CCSHARED="-fPIC" ./configure
# vi Makefile
如果CC= gcc -pthread,则修改为CC= gcc -pthread -fPIC
# make
# make install
注意:Python的安装目录是/usr/local/lib/python2.6/
四.安装mod_python
# tar -xvf mod_python-3.3.1.tar
# cd mod_python-3.3.1
# whereis apxs
apxs: /usr/sbin/apxs /usr/share/man/man8/apxs.8.gz
# ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
# make
# make install(/usr/local/lib/python2.6/site-packages/mod_python)
注意:如果没有源码包请到http://www.modpython.org/下载
五.配置Apache
# cd src
# cp mod_python.so /etc/httpd/modules/
# cd /etc/httpd/conf
# vi httpd.conf
添加LoadModule python_module modules/mod_python.so