1. 程式人生 > >Ubuntu環境下安裝PHP的yaf和yaml擴充套件

Ubuntu環境下安裝PHP的yaf和yaml擴充套件

一:前期準備

  1. 有些下載源必須要翻牆,這裡直接把映象的下載源更換為國內的,更換步驟請看上一篇文章。
  2. 安裝phpize(phpize是用來擴充套件php擴充套件模組的,通過phpize可以建立php的外掛模組)
    1. sudo apt install php7.1-dev #當前預設選擇的是PHP7.1,如果為7.2則改為php7.2-dev
    2. whereis phpize #檢視phpize是否安裝了,為空表示未安裝

二:安裝yaf擴充套件

  1. wget http://pecl.PHP.net/get/yaf-2.3.5.tgz
  2. tar zxvf yaf-2.3.5.tgz
  3. cd yaf-2.3.5
  4. whereis phpize #檢視phpize的位置
    phpize: /usr/bin/phpize /usr/bin/phpize7.1 /usr/share/man/man1/phpize.1.gz
  5. /usr/bin/phpize7.1
  6. whereis php-config #檢視config檔案位置
    php-config: /usr/bin/php-config /usr/bin/php-config7.1 /usr/share/man/man1/php-config.1.gz
  7. sudo ./configure --enable-ap-debug --with-php-config=/usr/bin/php-config7.1 #/usr/bin/php-config7.1為查詢的php-config
  8. sudo make && make install #編譯安裝
  9. sudo find -name yaf.so #檢視yaf.so是否生成
    ./home/yaf-3.0.7/modules/yaf.so
    ./home/yaf-3.0.7/.libs/yaf.so
    ./usr/lib/php/20160303/yaf.so
  10. 在php.ini 中新增 extension=yaf.so #php.ini根據phpinfo輸出的資訊查詢php.ini的位置
  11. 檢視phpinfo是否有yaf擴充套件

二:安裝yaml擴充套件(需要先安裝類庫)

  1. sudo wget http://pyyaml.org/download/libyaml/yaml-0.2.1.tar.gz
    . #The current release of LibYAML: 0.2.1 (2018-06-24)
  2. cd yaml-0.2.1
  3. ./configure
  4. make && make install
  5. 其他的步驟同安裝yaf擴充套件一樣