swoole1.8.0+版本非同步redis安裝(本執行個體為swoole1.8.10版本)詳解

來源:互聯網
上載者:User
Swoole-1.8.0+版本增加了對非同步Redis用戶端的支援,基於redis官方提供的hiredis庫實現。Swoole提供了__call魔術方法,來映射絕大部分Redis指令(本次安裝執行個體為swoole1.8.10版本)

編譯安裝hiredis (swoole1.8.10版本非同步redis支援必須環境條件)
使用Redis用戶端,需要安裝hiredis庫。下載hiredis源碼後,執行

make -j
sudo make install
sudo ldconfig (編譯安裝完記得執行該命令,否則PHP在引入swoole擴充時將出現類似如下紅色字型部分錯誤)
PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/swoole.so' - libhiredis.so.0.13: cannot open shared object file: No such file or directory in Unknown on line 0
hiredis下載地址: https://github.com/redis/hiredis  (https://github.com/redis/hiredis/releases)
啟用非同步Redis用戶端

編譯swoole是,在configure指令中加入 --enable-async-redis

./configure --enable-async-redis
make clean
make -j
sudo make install

因為這裡用到了swoole的更多向外延展群組件(ssl 、debug等),所以 摘取天上星 的實際編譯命令如下:

./configure --enable-async-redis --with-php-config=/usr/local/php/bin/php-config  --enable-openssl --enable-swoole-debug  --enable-sockets --enable-ringbuffer  --enable-swoole


swoole的./configure有很多額外參數,可以通過./configure --help命令查看,這裡均選擇預設項)
安裝完成後,進入/usr/local/php/etc目錄下,開啟php.ini檔案,在其中加上如下一句:
extension=swoole.so
隨後在終端中輸入命令 php -m 查看擴充安裝情況(或通過phpinfo()函數查看)。如果在列出的擴充中看到了swoole,則說明安裝成功。

聯繫我們

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