https://learnku.com/articles/11202/installation-of-yaf-in-virtualbox-vagrant-homesteadbox-environment
下載 Yaf 的最新版本,解壓縮以後,進入 Yaf 的源碼目錄,依次執行:
phpize
./configure --with-php-config=/usr/bin/php-config7.2
make
make install
如果 make install
後報錯類似:
cannot create regular file '/usr/lib/php/20170718/#INST@30150#': Permission denied Makefile:87: recipe for target 'install-modules' failed make: *** [install-modules] Error 1
需要權限,試試 sudo make install
然後在 php.ini 中載入 yaf.so :vim /etc/php/7.2/fpm/php.ini
文件處於不可編輯狀態,按 “i” 鍵後才能編輯,加入:
[yaf]
extension=yaf.so
編輯完後按 ESC 鍵然後輸入 :wq!
保存文件並退出時報錯:
Can't open file for writing
輸入 :qw!
取消改動退出編輯器,然後執行:sudo vim /etc/php/7.2/fpm/php.ini
配置成功後,重啓虛擬機,用官網的 hello world 測試擴展安裝成功。