本文實例講述了linux平臺編譯安裝PHP7并安裝Redis擴展與Swoole擴展的方法。分享給大家供大家參考,具體如下:
前面《PHP7安裝Redis擴展教程【Linux與Windows平臺】》一文告訴讀者簡單的安裝Redis的方法,下面我們來實現在linux中編譯安裝PHP7并安裝Redis擴展與Swoole擴展的方法。
編譯安裝PHP7并安裝Redis擴展Swoole擴展:
在編譯php7的機器上已經有編譯安裝過php5.3以上的版本,從而依賴庫都有了
本php7是編譯成fpm-php 使用的,如果是apache那么編譯參數應該為
--with-apxs2=/usr/local/apache/bin/apxs
編譯安裝php7:
wget -c http://www.php.net/distributions/php-7.0.0.tar.gztar zxvf php-7.0.0.tar.gzcd php-7.0.0./configure /--prefix=/usr/local/php7 /--with-config-file-path=/usr/local/php7/etc /--enable-fpm /--with-fpm-user=www /--with-fpm-group=www /--with-mysqli=mysqlnd /--with-pdo-mysql=mysqlnd /--with-iconv-dir /--with-freetype-dir=/usr/local/freetype /--with-jpeg-dir -/-with-png-dir /--with-zlib /--with-libxml-dir=/usr /--enable-xml /--disable-rpath /--enable-bcmath /--enable-shmop /--enable-sysvsem /--enable-inline-optimization /--with-curl /--enable-mbregex /--enable-mbstring /--with-mcrypt /--enable-ftp /--with-gd /--enable-gd-native-ttf /--with-openssl /--with-mhash /--enable-pcntl /--enable-sockets /--with-xmlrpc /--enable-zip /--enable-soap /--with-gettext /--disable-fileinfo /--enable-opcachemake ZEND_EXTRA_LIBS='-liconv'make installcp php.ini-production /usr/local/php7/etc/php.inicd ..
編譯安裝php7的redis擴展支持:
wget -c https://github.com/phpredis/phpredis/archive/php7.zipunzip php7.zipcd phpredis-php7/usr/local/php7/bin/phpize./configure --with-php-config=/usr/local/php7/bin/php-configmakemake installcd ..
/usr/local/php7/etc/php.ini 中加入:
extension=redis.so
編譯安裝php7的swoole
wget -c https://github.com/swoole/swoole-src/archive/swoole-1.7.21-stable.tar.gztar zxvf swoole-1.7.21-stable.tar.gzcd swoole-src-swoole-1.7.21-stable//usr/local/php7/bin/phpize./configure --with-php-config=/usr/local/php7/bin/php-configmakemake installcd ..
/usr/local/php7/etc/php.ini 中加入:
extension=swoole.so
希望本文所述對大家PHP程序設計有所幫助。
新聞熱點
疑難解答
圖片精選