CentOS下安装php 5.6.19

# php安装包下载
wget https://www.php.net/distributions/php-5.6.19.tar.bz2
# 解压
bunzip2 php-5.6.19.tar.bz2
tar xvf php-5.6.19.tar

# 配置安装php (中间可能报缺少某些包, 按照缺少的提示装上即可)
cd php-5.6.19
./configure --prefix=/usr/local/php-5.6.19 --with-config-file-path=/usr/local/php-5.6.19/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath --without-pear

make && make install

# 设置软链接
ln -s /usr/local/php-5.6.19 /usr/local/php

ln -s /usr/local/php/bin/php /usr/bin/php

 #测试是否配置好路径

php -v

 

能正确打印版本号说明是配置成功!

#配置文件拷贝到/etc/
cp php.ini-production /usr/local/php-5.6.19/etc/php.ini
cp /usr/local/php-5.6.19/etc/php-fpm.conf.default /usr/local/php-5.6.19/etc/php-fpm.conf
cp -rf sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#增加执行权限
chmod +x /etc/init.d/php-fpm
#环境变量配置
echo "export PHP_HOME=/usr/local/php" >> /etc/profile
echo "export PATH=$PATH:$PHP_HOME/bin" >> /etc/profile
#配置生效
source /etc/profile
#增加开机启动
chkconfig --add php-fpm
chkconfig php-fpm on
#启动php
service php-fpm start

#验证是否已经启动
service php-fpm status

#出现如下说明已经成功

 

 

 

posted @ 2019-06-17 12:07  小马哥的春天  阅读(517)  评论(0编辑  收藏  举报