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 安裝tensorflow異常處理CentOS
- CentOS6.X 升級核心CentOS
- linux CentOS6.x 修改主機名(Hostname)LinuxCentOS
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- BiocManager安裝,devtools安裝dev
- Linux安裝解除安裝MySQLLinuxMySql
- linux 安裝yum 安裝phpLinuxPHP
- Ubuntu解除安裝和安裝Ubuntu
- 02 安裝git、安裝TortoiseGitGit
- cocoapods安裝/解除安裝/使用
- JDK安裝和解除安裝JDK
- ffmpeg安裝之mac安裝Mac
- docker安裝及解除安裝Docker
- [ 安裝 ] Zeppelin安裝步驟!
- win10安裝版怎麼安裝_安裝版win10安裝教程Win10
- ElasticSearch的安裝和使用,Postman的安裝,Kibana的安裝,EShead外掛的安裝ElasticsearchPostman
- Mac Redis安裝與解除安裝MacRedis
- 安裝了IDLE後安裝tensorflow
- kratos安裝及依賴安裝
- Linux 解除安裝openjdk 安裝oraclejdkLinuxJDKOracle
- debian安裝和解除安裝vmware
- JDK的安裝與解除安裝JDK
- linux 解除安裝jdk和安裝LinuxJDK
- 【推薦 - glibc安裝】MySQL - 安裝MySql
- linux下安裝snap安裝工具Linux
- [雲原生]Docker - 安裝&解除安裝Docker
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- window下安裝並使用nvm(含解除安裝node、解除安裝nvm、全域性安裝npm)NPM
- CentOS6.x使用163和epel yum源的選擇CentOS
- CentOS6.x實現單網路卡雙IP的方法CentOS
- 安裝
- air安裝win10怎麼解除安裝_air安裝win10如何解除安裝AIWin10
- Centos Docker安裝、升級、解除安裝CentOSDocker
- Webpack學習 – Webpack安裝及安裝Web
- Linux-Ubuntu-mysql-安裝&解除安裝LinuxUbuntuMySql
- Centos7.9安裝解除安裝DockerCentOSDocker
- Centos7安裝安裝部署dockerCentOSDocker