1. Initial environment Installation
Httpd-related RPM package version:
Httpd-2.2.3-63.el5.centos.1
Httpd-devel-2.2.3-63.el5.centos.1
Apr-1.2.7-11.el5_3.1
Apr-devel-1.2.7-11.el5_3.1
Apr-util-1.2.7-11.el5
Apr-util-devel-1.2.7-11.el5
2. Compile the python 2.7
./Configure-enable-shared
Wget http://www.python.org/ftp/python/2.7/Python-2.7.tar.bz2
Tar jfvx Python-2.7.tar.bz2
CD Python-2.7
./Configure-enable-shared
Make all
Make install
Make clean
Make distclean
----------------------------------------
Python 2.4 is installed by default. perform the following operations:
MV/usr/bin/Python-Bak
Ln-S/usr/local/bin/python2.7/usr/bin/Python
Sed-I's /#! \/Usr \/bin \/Python /#! \/Usr \/bin \/python2.4/G'/usr/bin/yum
------------------------------------------
After the installation is complete, the execution of Python should fail. The error message is:
/Usr/local/bin/Python: Error while loading shared libraries: libpython2.7.so. 1.0: cannot open shared object file: no such file or directory
Solution:
Vim/etc/lD. So. conf
Add a new row:
/Usr/local/lib
Then execute:
/Sbin/ldconfig
/Sbin/ldconfig-V
3. Install mod_python-3.3.1
Step 1:./configure -- With-apxs =/usr/sbin/apxs
Step 2:
VI src/connobject. c
Modify
! (B = apr_brigade_sentinel (B) |
Is
! (B = apr_brigade_sentinel (bb) |
Step 3:
Make
Step 4:
Make install
After installation, go to the/usr/lib64/httpd/modules directory.
Check whether there is
Mod_python.so
reference:
http://stackoverflow.com/questions/7880454/python-executable-not-finding-libpython-shared-library
http://hi.baidu.com/iwater707/item/34b71827e08487150975081d
http://bbs.chinaunix.net/thread-1198737-1-1.html
http://linux.chinaitlab.com/set/852148.html
http://www.360doc.com/content/12/0322/18/6938655_196712249.shtml