編譯安裝php5.6.12

來源:互聯網
上載者:User

標籤:php   fpm   系統服務   

一、系統內容說明

      本次實驗基於CentOS6.8_x64 (6.x均可),編譯安裝php5.6.12 包含以下四個擴充模組(包):

libmcrypt-2.5.8.tar.gz ;php-redis.tar.gz;jpegsrc.v8d.tar.gz ;zendopcache-7.0.5.tar.gz

可自行到對應官方網站 下載最新軟體包,本例軟體包版本如上所列,如需要本例軟體壓縮包php5.6.12.tar.gz請到以下百度網盤地址中擷取 ,壓縮包中包含以上安裝包,並附自動安裝指令碼和php-fpm56系統服務指令碼;

連結:https://pan.baidu.com/s/1kUHaxDX  如打不開請留言聯絡我!


二、指令碼及說明

代碼如下:

#!/bin/bashsrc=$(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-develcd $srctar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configuremake && make installcd $srctar zxvf jpegsrc.v8d.tar.gzcd jpeg-8d./configure -enable-shared -enable-staticmake && make install cleancd $srctar xvf php-5.6.12.tar.gzcd 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-exifmakemake install###Configure php-fpm[ -d /data1/log/ ] || mkdir -pv data1/logecho ‘export PATH=/usr/php5.6/bin:$PATH‘ >/etc/profile.d/php5.6.shsource /etc/profile.d/php5.6.shcd $srccd php-5.6.12\cp php.ini-production /usr/php5.6/etc/php.inirm -rf /etc/php.iniln -s /usr/php5.6/etc/php.ini /etc/php.iniln -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.confsed -i "s/^;pid = run\/php-fpm.pid/pid = run\/php-fpm56.pid/g" /usr/php5.6/etc/php-fpm.confif [ -u nginx ]thensed -i "s/^user = nobody/user = nginx/g" /usr/php5.6/etc/php-fpm.confsed -i "s/^group = nobody/group = nginx/g" /usr/php5.6/etc/php-fpm.conffised -i "s/^;error_log = log\/php-fpm.log/error_log = \/data1\/log\/php-fpm56.log/g" /usr/php5.6/etc/php-fpm.confcp $src_tmp/php-fpm56 /etc/init.d/php-fpm56chmod +x /etc/init.d/php-fpm56chkconfig --add php-fpm56chkconfig php-fpm56 onservice php-fpm56 start#Add Zendopcachecd $srctar xvf zendopcache-7.0.5.tar.gzcd zendopcache-7.0.5phpize./configuremakemake installcd $srctar xvf php-redis.tar.gzcd php-redis-2.2.7phpize./configuremakemake installsed -i "716s:.*:extension_dir = \/usr\/php5.6\/lib\/php\/extensions\/no-debug-non-zts-20131226\/:g" /usr/php5.6/lib/php.inised -i "s/^;date.timezone =/date.timezone = Asia\/Shanghai/g" /usr/php5.6/lib/php.inised -i "s/^expose_php = On/expose_php = Off/g" /usr/php5.6/lib/php.inised -i "s/^display_errors = Off/display_errors = On/g" /usr/php5.6/lib/php.inised -i "s/^;error_log = php_errors.log/error_log = \/data1\/log\/php_errors.log/g" /usr/php5.6/lib/php.inised -i "s/^display_startup_errors = Off/display_startup_errors = On/g" /usr/php5.6/lib/php.iniecho ‘zend_extension=/usr/php5.6/lib/php/extensions/no-debug-non-zts-20131226/opcache.soopcache.memory_consumption=128opcache.interned_strings_buffer=8opcache.max_accelerated_files=4000opcache.revalidate_freq=60opcache.fast_shutdown=1opcache.enable_cli=1‘>>/usr/php5.6/lib/php.iniecho "extension=redis.so" >>/usr/php5.6/lib/php.ini

說明 :指令碼中定義編譯安裝到/usr/php5.6 如果需要安裝到別的目錄,請自行修改


三、安裝過程

1、測試安裝步驟

解壓下載好的壓縮包並進入解壓後的軟體包目錄並運行一鍵安裝指令碼auto_install.sh

#tar xvf php5.6.12.tar.gz#cd php5.6.12#./auto_install.sh

安裝過程隨機器效能需要等待一段時間;

2、驗證

安裝過程省略

安裝完成後系統登出,再登入執行以下驗證

#php -v

PHP 5.6.12 (cli) (built: Jun 29 2017 17:21: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-fpm56 status

php-fpm56 (pid 22970) is running...


本實驗僅供參考,如有不當之處歡迎指正!


本文出自 “學地止境” 部落格,請務必保留此出處http://dyc2005.blog.51cto.com/270872/1943227

編譯安裝php5.6.12

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.