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.tarphp

# 配置安裝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-pearmysql

make && make installsql

# 設置軟連接
ln -s /usr/local/php-5.6.19 /usr/local/phpapi

#配置文件拷貝到/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
#環境變量配置
cat "export PHP_HOME=/usr/local/php" >> /etc/profile
cat "export PATH=$PATH:$PHP_HOME/bin" >> /etc/profile
#配置生效
source /etc/profile
#增長開機啓動
chkconfig --add php-fpm
chkconfig php-fpm on
#啓動php
service php-fpm startdom

#驗證是否已經啓動
php -v
能正確打印版本號說明是安裝成功!curl

相關文章
相關標籤/搜索