Compile and install php-5.4.27 as Apache module

Source: Internet
Author: User

Why install a lower version of PHP?
Since the updated version of Apc,xcache does not keep up with the speed of the PHP version, we need to install a relatively stable PHP low version of the program, and then install other matching extensions.

Start:

New users and user groups
Groupadd WebUser
Useradd-g WebUser WebUser

Download php-5.4
wget http://blog.xinfilm.com/softdir/php-5.4.27.tar.gz

#解包
Tar zxvf php-5.4.27.tar.gz
CD php-5.4.27

./configure--PREFIX=/SERVER/PHP5 \
--enable-sockets \
--WITH-APXS2=/SERVER/APACHE2/BIN/APXS \
--with-mysql=/server/mysql \
--WITH-MYSQLI \
--with-mysqli=/server/mysql/bin/mysql_config \
--with-pdo-mysql=/server/mysql \
--WITH-JPEG-DIR=/USR/LIB64 \
--with-curl \
--enable-mbstring=all \
--WITH-CONFIG-FILE-PATH=/SERVER/PHP5/ETC \
--ENABLE-SOAP \
--with-freetype-dir=/usr/local/lib \
--WITH-GD \
--with-gettext

#编译 and install
Make && make install

Vi/server/apache2/conf/httpd.conf
#增加Addtype Line
AddType application/x-httpd-php. php

CP./php.ini-production/server/php5/etc/php.ini

#编辑include_path
Vi/server/php5/etc/php.ini
include_path = ".:/ Php/includes:/server/php5/lib/php "
Cgi.fix_pathinfo=1
Date.timezone = Asia/shanghai

#启用了selinux的系统需要如下一行操作
Chcon-t texrel_shlib_t/server/apache2/modules/libphp5.so

#重启Apache
/server/apache2/bin/apachectl restart

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.