手動安裝Yar擴展(也適用於其他版本)

字號+ 編輯: 种花家 修訂: 人在硅谷 來源: cnblogs 2023-09-12 我要說兩句(0)

Yar解決了想倣epoll的問題, 鳥哥封裝了一堆curl在裡面。本文說說如何安裝鳥哥的Yar擴展插件。

寫在前面

如果不是在純内網用, 筆者是不推薦用Yar的。因爲源碼裡面看,基本都是在封裝curl。

php7.0+的yar

yar的git地址:https://github.com/laruence/yar

先克隆 如果沒有 git 需要先安裝

yum install git

然後 克隆

git clone https://github.com/laruence/yar.git

然後 進入yar 目錄

cd yar

開始編譯安裝

[php安裝路徑]/bin/phpize
./configure --with-php-config=[php安裝路徑]/bin/php-config
make && make install

然後把擴展添加到 php配置文档中, 例如

cd [php配置文档路徑, 例如/usr/local/php/etc]
vim php.ini

寫入:

extension=yar.so

保存退出。

重啓php nginx

php5.x的Yar

yar linux平台針對php5.x版本的兼容 http://pecl.php.net/get/yar-1.2.5.tgz

下載頁面 http://pecl.php.net/package/yar

安裝方法:

下載完yar-1.2.5.tgz這個包之後放到linux主機root文档夾下, 用以下命令解壓:

# 假設你已經用ftp或者rz -E傳好了yar-1.2.5.tgz這個文档
cd /root
tar zxvf yar-1.2.5.tgz

之後同yar在php7.0的安裝方法一樣, 一套命令做下來:

cd yar-1.2.5
[php安裝路徑]/bin/phpize
./configure --with-php-config=[php安裝路徑]/bin/php-config
make && make install
vim [php配置文档路徑]/php.ini

加入以下配置:

extension="yar.so"

報錯解決

Cannot find config.m4. 

Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module

很簡單, 說明你沒進yar的安裝目錄, 你需要先cd到yar的安裝目錄, 例如

cd yar-1.2.5

才可以

閲完此文,您的感想如何?
  • 有用

    0

  • 沒用

    0

  • 開心

    0

  • 憤怒

    0

  • 可憐

    0

1.如文章侵犯了您的版權,請發郵件通知本站,該文章將在24小時内刪除;
2.本站標注原創的文章,轉發時煩請注明來源;
3.交流群: 2702237 13835667

相關課文
  • mac開發接入微信公衆號接口返回報錯 cURL error 56: SSLRead() return error -9806

  • PHP的換行符是什麽

  • pecl安裝程序時報錯Array and string offset access syntax with curly braces is no longer supported

  • 由於商家傳入的H5交易參數有誤,該筆交易暫時無法完成,請聯繫商家解決

我要說說
網上賓友點評