編譯安裝php,開啟php-redis功能

來源:互聯網
上載者:User

標籤:mysq   cal   text   sqlite   code   ring   就是   完成   str   

首先先下載php的安裝包 我用的是php-5.5.7.tar.gz。

安裝依賴包:yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel  libxml2 libxml2-devel libcurl libcurl-devel libxslt-devel openssl-devel cc gcc cp php-5.5.7.tar.gz /usr/localtar xzvf php-5.5.7.tar.gzcd /usr/local/php-5.5.7添加你要開啟的功能 ,下面是我的配置./configure \

--prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-jpeg-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysql \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip

配置完成後,make & make install  然後呢php就安裝完成了組建組態檔案:cp /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.confcp  /usr/local/php-5.5.7/php.ini-production/usr/local/php/lib/php.iniphp的編譯安裝完成了,接下來我們做phpredis的擴充:下載phpredis的擴充包https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz  下載redis的擴充包。然後放到 /usr/local 下邊,解壓 tar xzvf  2.2.4.tar.gzcd 2.2.4 /usr/local/php/bin/phpize   產生 configure的設定檔如果不能產生的話: yum install -y autoconf 

然後進行配置:
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

安裝完成後就會產生一下檔案:(檢查一下)/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/  說明phpredis 就安裝成功了,然後就是進行配置,在php的配置文檔中進行配置,在php.ini 裡邊,在前邊已經複製過了vim php.ini   最後一行添加extension="redis.so"然後重啟php-fpm服務  在nginx的發布目錄裡邊 cd /usr/share/nginx/htmlmv index.html index.html.bakvim index.php寫<?php

phpinfo();
?>
儲存 推出

nginx -s reload 重新載入nginx 然後就訪問,看頁面上有沒有支援redis的那一項,要往下看才有。

編譯安裝php,開啟php-redis功能

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.