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扩展一样

猜你喜欢

转载自blog.csdn.net/xfxf0520/article/details/82975966