php5.6.x独立编译安装

来源:互联网 发布:胎儿b超数据 编辑:程序博客网 时间:2024/06/06 11:36

安装依赖

yum -y install gcc gcc-c++ autoconf automake bison cmake curl curl-devel libzip libXpm libcurl-devel zlib-devel libcom_err-devel libpng-devel  libjpeg* libsepol-devel libselinux-devel openssl openssl-devel pcre-devel php-common php-gd  wget zlib ncurses-devel libxml2 libxml2-devel gd-devel flex  bzip2 libmcrypt  yasm nasm readline-devel libvpx-devel t1lib*



安装libmcrypt(php扩展)

wget -c https://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gztar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure && make && make install



编译安装PHP 5.6.31

wget -c http://mirrors.sohu.com/php/php-5.6.31.tar.gztar -zxvf php-5.6.31.tar.gzcd php-5.6.31
./configure --prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--with-mysql=mysqlnd --with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-png-dir=/usr \--with-jpeg-dir=/usr \--with-freetype-dir=/usr \--with-vpx-dir=/usr \--with-t1lib=/usr \--with-libxml-dir=/usr/include/libxml2/libxml \--with-openssl-dir=/usr \--with-openssl \--without-pear \--with-gettext \--with-readline \--with-mhash \--with-mcrypt \--with-xmlrpc \--with-iconv \--with-curl \--with-zlib \--with-bz2 \--with-gd \--enable-inline-optimization \--enable-gd-native-ttf \--enable-mbstring \--enable-session \--enable-sockets \--enable-sysvsem \--enable-sysvmsg \--enable-sysvshm \--enable-opcache \--enable-mbregex \--enable-libxml \--enable-bcmath \--enable-shmop \--enable-pcntl \--enable-ctype \--enable-soap \--enable-fpm \--enable-ftp \--enable-zip \--enable-cli \--enable-xml

配置完成效果

make #进入漫长的编译过程中...

编译完成

make install  # 安装

这里写图片描述



文件配置

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confln -sb /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf



编辑配置文件

vi /etc/php-fpm.conf
pid = run/php-fpm.pid #取消前面的分号
vi  /etc/php.ini
date.timezone = Asia/Shanghaiexpose_php = Off #禁止显示php版本的信息extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"



测试php-fpm配置

/usr/local/php/sbin/php-fpm -t
[26-Aug-2017 10:28:37] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
ln -sb /usr/local/php/bin/php /usr/bin/php -v
PHP 5.6.31 (cli) (built: Aug 26 2017 10:00:00) Copyright (c) 1997-2016 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies



设置 php-fpm开机启动

cp /root/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod 755 /etc/rc.d/init.d/php-fpmchkconfig php-fpm on