Yaf扩展是为php yaf框架准备的,要使用yaf框架的话就得先安装php的yaf扩展支持,安装yaf扩展前需要安装好php,安装方法为:
lnmp.org官网 https://lnmp.org/install.html
lnmp 管理命令https://lnmp.org/faq/lnmp-status-manager.html
安装lnmp集成环境的步骤
1、下载安装yaf扩展库源码安装包
官网下载页面:http://pecl.php.net/package/yaf
如图:
2、下载扩展库源码安装包
wget -c http://pecl.php.net/get/yaf-3.0.7.tgz
3、解压yaf扩展yaf-3.0.7.tgz包
tar -xzvf yaf-3.0.7.tgz
cd yaf-3.0.7
4、生成编译configure配置文件
[root@zixuephp yaf-3.0.7]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
[root@zixuephp yaf-3.0.7]# ls
acinclude.m4 config.sub Makefile.global tests yaf.c yaf_exception.c yaf_plugin.h yaf_router.h
aclocal.m4 configure missing views yaf_config.c yaf_exception.h yaf_registry.c yaf_session.c
autom4te.cache configure.in mkinstalldirs yaf_action.c yaf_config.h yaf_loader.c yaf_registry.h yaf_session.h
build config.w32 php_yaf.h yaf_action.h yaf_controller.c yaf_loader.h yaf_request.c yaf_view.c
config.guess CREDITS requests yaf_application.c yaf_controller.h yaf_logo.h yaf_request.h yaf_view.hconfig.h.in install-sh responses yaf_application.h yaf_dispatcher.c yaf_namespace.h yaf_response.c
config.m4 LICENSE routes yaf_bootstrap.c yaf_dispatcher.h yaf.php yaf_response.h
configs ltmain.sh run-tests.php yaf_bootstrap.h yaf.dsp yaf_plugin.c yaf_router.c
5、执行配置文件
[root@zixuephp yaf-3.0.7]# ./configure --with-php-config=/usr/local/php/bin/php-config
6、编译并安装
[root@zixuephp yaf-3.0.7]# make && make install
#安装完成后会提示
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/
7、在php的配置文件中引用扩展
#找到php.ini
cd /usr/local/php/etc/
vi php.ini
#文件内容末尾加入
extension=yaf.so
8、重启php-fpm服务配置生效
service php-fpm restart
在安装完后通过运行php中的phpinfo()查看扩展信息,如图: