编译安装php5.6.12
2021-07-08 21:03
标签:php fpm 系统服务 一、系统环境说明 本次实验基于CentOS6.8_x64 (6.x均可),编译安装php5.6.12 包含以下四个扩展模块(包): libmcrypt-2.5.8.tar.gz ;php-redis.tar.gz;jpegsrc.v8d.tar.gz ;zendopcache-7.0.5.tar.gz 可自行到对应官方网站 下载最新软件包,本例软件包版本如上所列,如需要本例软件压缩包php5.6.12.tar.gz请到以下百度网盘地址中获取 ,压缩包中包含以上安装包,并附自动安装脚本和php-fpm56系统服务脚本; 链接:https://pan.baidu.com/s/1kUHaxDX 如打不开请留言联系我! 二、脚本及说明 代码如下: 说明 :脚本中定义编译安装到/usr/php5.6 如果需要安装到别的目录,请自行修改 三、安装过程 1、测试安装步骤 解压下载好的压缩包并进入解压后的软件包目录并运行一键安装脚本auto_install.sh 安装过程随机器性能需要等待一段时间; 2、验证 安装过程省略 安装完成后系统登出,再登录执行以下验证 #php -v PHP 5.6.12 (cli) (built: Jun 29 2017 17:21:49) #service php-fpm56 status php-fpm56 (pid 22970) is running... 本实验仅供参考,如有不当之处欢迎指正! 本文出自 “學地止境” 博客,请务必保留此出处http://dyc2005.blog.51cto.com/270872/1943227 编译安装php5.6.12 标签:php fpm 系统服务 原文地址:http://dyc2005.blog.51cto.com/270872/1943227#!/bin/bash
src=$(pwd) #解压软件包进入目录,或自行下载所需要软件包存放位置
#安装依赖环境
yum install -y gcc gcc-c++ openssl openssl-devel libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel gd bzip2 bzip2-devel curl curl-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel
cd $src
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
cd $src
tar zxvf jpegsrc.v8d.tar.gz
cd jpeg-8d
./configure -enable-shared -enable-static
make && make install clean
cd $src
tar xvf php-5.6.12.tar.gz
cd php-5.6.12
./configure --prefix=/usr/php5.6 --with-libxml-dir=/usr/include/libxml2 --with-mysql --with-mysqli --with-gd --enable-gd-native-ttf --with-zlib --with-mcrypt --with-pdo-mysql --enable-shmop --enable-sockets --enable-zip --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local/ --with-iconv --enable-xml --enable-bcmath --enable-sysvsem --with-openssl --enable-pcntl --with-gettext --enable-session --enable-exif
make
make install
###Configure php-fpm
[ -d /data1/log/ ] || mkdir -pv data1/log
echo ‘export PATH=/usr/php5.6/bin:$PATH‘ >/etc/profile.d/php5.6.sh
source /etc/profile.d/php5.6.sh
cd $src
cd php-5.6.12
\cp php.ini-production /usr/php5.6/etc/php.ini
rm -rf /etc/php.ini
ln -s /usr/php5.6/etc/php.ini /etc/php.ini
ln -s /usr/php5.6/etc/php.ini /usr/php5.6/lib/php.ini
\cp /usr/php5.6/etc/php-fpm.conf.default /usr/php5.6/etc/php-fpm.conf
sed -i "s/^;pid = run\/php-fpm.pid/pid = run\/php-fpm56.pid/g" /usr/php5.6/etc/php-fpm.conf
if [ -u nginx ]
then
sed -i "s/^user = nobody/user = nginx/g" /usr/php5.6/etc/php-fpm.conf
sed -i "s/^group = nobody/group = nginx/g" /usr/php5.6/etc/php-fpm.conf
fi
sed -i "s/^;error_log = log\/php-fpm.log/error_log = \/data1\/log\/php-fpm56.log/g" /usr/php5.6/etc/php-fpm.conf
cp $src_tmp/php-fpm56 /etc/init.d/php-fpm56
chmod +x /etc/init.d/php-fpm56
chkconfig --add php-fpm56
chkconfig php-fpm56 on
service php-fpm56 start
#Add Zendopcache
cd $src
tar xvf zendopcache-7.0.5.tar.gz
cd zendopcache-7.0.5
phpize
./configure
make
make install
cd $src
tar xvf php-redis.tar.gz
cd php-redis-2.2.7
phpize
./configure
make
make install
sed -i "716s:.*:extension_dir = \/usr\/php5.6\/lib\/php\/extensions\/no-debug-non-zts-20131226\/:g" /usr/php5.6/lib/php.ini
sed -i "s/^;date.timezone =/date.timezone = Asia\/Shanghai/g" /usr/php5.6/lib/php.ini
sed -i "s/^expose_php = On/expose_php = Off/g" /usr/php5.6/lib/php.ini
sed -i "s/^display_errors = Off/display_errors = On/g" /usr/php5.6/lib/php.ini
sed -i "s/^;error_log = php_errors.log/error_log = \/data1\/log\/php_errors.log/g" /usr/php5.6/lib/php.ini
sed -i "s/^display_startup_errors = Off/display_startup_errors = On/g" /usr/php5.6/lib/php.ini
echo ‘zend_extension=/usr/php5.6/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1‘>>/usr/php5.6/lib/php.ini
echo "extension=redis.so" >>/usr/php5.6/lib/php.ini
#tar xvf php5.6.12.tar.gz
#cd php5.6.12
#./auto_install.sh
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
下一篇:ajax 快速入门