CENTOS5.8 64位系统编译安装apache以及PHP7环境

2017-11-6 admin linux

CENTOS5.8 64位系统编译安装apache以及PHP7环境

首先YUM安装依赖包

yum install -y openssl-devel cmake libxml2-devel curl-devel freetype-devel libpng-devel libjpeg-devel ncurses-devel autoconf

由于centos5.8的openssl版本低 需要编译安装openssl的1.0.1版本

openssl官网下载安装包openssl-1.0.1s.tar.gz

编译安装openssl

tar xvf openssl-1.0.1s.tar.gz

cd openssl-1.0.1s

./config -fPIC --prefix=/usr/local/openssl enable-shared

make

make install

编译安装pcre库

tar xvf pcre-8.38.tar.gz

cd pcre-8.38/

./configure

make

make install

apache官网下载源码包

tar xvf apr-1.5.2.tar.gz

tar xvf apr-util-1.5.4.tar.gz

tar xvf httpd-2.4.18.tar.gz

安装apache的目录为/opt/data/apache2/test

这里需指定之前的编译安装的openssl目录

cd httpd-2.4.18

mv ../apr-1.5.2 ./srclib/apr

mv ../apr-util-1.5.4 ./srclib/apr-util

./configure --prefix=/opt/data/apache2/test --enable-so --with-mpm=worker --enable-rewrite --enable-ssl --enable-static-support --enable-expires --enable-mods-shared=all --enable-module=so --with-included-apr --with-pcre=/usr/local/bin/pcre-config --with-ssl=/usr/local/openssl

make

make install

官网下载php7源码包

tar xvf php-7.0.2.tar.gz

这里需指定之前的编译安装的openssl目录

cd php-7.0.2

./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-apxs2=/opt/data/apache2/test/bin/apxs --with-mhash --with-openssl=/usr/local/openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi

make

make install

将源码包内的配置文件拷贝到安装好的php目录下

cp php.ini-production /usr/local/php7/etc/php.ini

添加PHP7的redis支持

wget -c https://github.com/phpredis/phpredis/archive/php7.zip<br />
unzip php7

cd phpredis-php7/

/usr/local/php7/bin/phpize

./configure --with-php-config=/usr/local/php7/bin/php-config

make

make install

mv /usr/local/php7/lib/php/extensions/no-debug-zts-20151012/* /usr/local/php7/lib/php/extensions/

修改PHP.INI文件添加相关支持

vi /usr/local/php7/etc/php.ini

加到最后

extension_dir = "/usr/local/php7/lib/php/extensions"

extension=pdo_mysql.so

extension=mysqli.so

extension=redis.so

zend_extension=opcache.so

标签: CentOS Apache PHP

发表评论:

Powered by emlog

浙ICP备17021512号 |浙公网安备 33010602008237号