全面解析php7安裝yar擴充的方法

來源:互聯網
上載者:User
本文主要介紹php7安裝yar擴充的方法,結合執行個體形式較為詳細的分析了php7安裝yar擴充的具體步驟、相關命令與注意事項,需要的朋友可以參考下,希望能協助到大家。

體驗RPC架構Yar需要:

1. 裝二進位打包協議msgpack

2. 裝yar拓展和依賴

一. 安裝二進位打包協議msgpack

1. 安裝PHP拓展包有很多種方式,當然沒什麼是比pecl更加來得暴力,用這個之前要確認phpize是否存在


find / -name phpize

2. 如果phpize不存在


yum install php-devel

3. Ok,先裝msgpack


pecl install msgpack

安裝跳了一大堆編譯過程過程,省略ING 只關心後幾行


Build process completed successfullyInstalling '/usr/include/php/ext/msgpack/php_msgpack.h'Installing '/usr/lib64/php/modules/msgpack.so'install ok: channel://pecl.php.net/msgpack-0.5.6configuration option "php_ini" is not set to php.ini locationYou should add "extension=msgpack.so" to php.ini

安裝完 msgpack.so 會自動複製到 php 擴充庫,並寫好配置。

二. 安裝 yar

1. 下載 yar


wget http://pecl.php.net/get/yar-2.0.0.tgz

2. 解壓編譯


tar -zxvf yar-2.0.0.tgzcd cd yar-2.0.0/usr/bin/phpize./configure --with-php-config=/usr/bin/php-config7.0*

遇到問題:

checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

3. 安裝 curl-devel


yum -y install curl-develsudo apt-get install libcurl4-gnutls-dev

ps:curl vs curl-deval

參考: http://stackoverflow.com/questions/4976971/compiling-php-with-curl-where-is-curl-installed

4. 安裝 yar


make && make install

5. 複製 yar.so 到 php 擴充庫下


sudo cp yar.so /usr/lib/php/20151012/yar.so

6. 擴充寫設定檔


echo "extension=yar.so" > /etc/php/7.0/mods-available/yar.iniln -sf /etc/php/7.0/mods-available/yar.ini /etc/php/7.0/fpm/conf.d/20-yar.iniln -sf /etc/php/7.0/mods-available/yar.ini /etc/php/7.0/cli/conf.d/20-yar.ini

7. 重啟 php-fpm nginx


service php7.0-fpm restartservice nginx restart

ps: php -ir 查詢 phpinfo

聯繫我們

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