Install mod_python on centos

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.