CentOS6.x安裝php5.6.x
一、系統及安裝說明
系統:CentOS6.x_x64,php5.6.12版本以及四個擴充套件模組(libmcrypt-2.5.8.tar.gz ;php-redis.tar.gz;jpegsrc.v8d.tar.gz ;zendopcache-7.0.5.tar.gz)。
共享連結: 密碼: dftq
二、安裝指令碼及說明
1、下載完安裝包並解壓
#!/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-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm 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
儲存好php_install.sh。 預設設定安裝在/usr/php5.6目錄下。
三、安裝流程
1、解壓並安裝
解壓下載好的壓縮包並進入解壓後的軟體包目錄並執行一鍵安裝指令碼php_install.sh
#tar xvf php5.6.12.tar.gz
#cd php5.6.12
#./php_install.sh
安裝過程隨機器效能需要等待一段時間;
2、驗證
安裝完成後系統登出,再登入執行以下驗證
#php -v
PHP 5.6.12 (cli) (built: Dec 2 2017 00:12:49)
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
#service php-fpm status
php-fpm56 (pid 6276) is running...
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4479/viewspace-2801515/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS6.x安裝RabbitMQCentOSMQ
- CentOS6.X系統安裝CentOS
- Redhat/Centos6.x安裝ChromeRedhatCentOSChrome
- centos6.x 安裝tensorflow異常處理CentOS
- CentOS6.x 安裝Bitnami Jenkins 2.xCentOSJenkins
- centos6.x 安裝pylucene (20161027改)CentOS
- CentOS6.X 升級核心CentOS
- codis安裝 (java 安裝 + zookeeper 安裝 + go 安裝 + codis 安裝JavaGo
- linux CentOS6.x 修改主機名(Hostname)LinuxCentOS
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- mysql安裝 (yum 安裝)MySql
- MMM安裝、MHA安裝
- CentOS6.x和CentOS7.x的區別CentOS
- mysql安裝------RPM包安裝及解除安裝MySql
- oracle安裝:OUI安裝Oracle(圖形介面安裝)OracleUI
- ffmpeg安裝之mac安裝Mac
- docker安裝及解除安裝Docker
- 02 安裝git、安裝TortoiseGitGit
- Ubuntu解除安裝和安裝Ubuntu
- Orace RAC安裝-DNS安裝DNS
- caffe安裝系列——安裝OpenCVOpenCV
- SPARK 安裝之scala 安裝Spark
- mac 安裝opencv homebrew安裝MacOpenCV
- Oracle 安裝與解除安裝Oracle
- solaris mysql 安裝 解除安裝MySql
- BiocManager安裝,devtools安裝dev
- JDK安裝和解除安裝JDK
- 安裝HomeBrew提示已安裝並無法解除安裝
- SQL Server 2012 安裝——安裝 OR 解除安裝SQLServer
- win10安裝版怎麼安裝_安裝版win10安裝教程Win10
- CentOS6.x實現單網路卡雙IP的方法CentOS
- mysql安裝-----二進位制包安裝及解除安裝MySql
- cocoapods安裝/解除安裝/使用
- Mac Redis安裝與解除安裝MacRedis
- [ 安裝 ] Zeppelin安裝步驟!
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- linux 安裝yum 安裝phpLinuxPHP
- [雲原生]Docker - 安裝&解除安裝Docker