安装好php环境之后
安装扩展包
$yum install php-devel
/usr/bin/ 就会出现phpize工具包
下载yaf-2.2.8.gz源文件,解压后,进入源文件
phpize
[[email protected] yaf-2.2.8]# phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
$./configure
$make
$make install
若出现报错
/usr/include/php/ext/pcre/php_pcre.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/php/ext/pcre/php_pcre.h:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before ‘pcre’
make: *** [yaf_router.lo] Error 1
安装pcre
$yum install pcre-devel
还报错的话,直接下载pcre源码包安装。
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
pcre-8.33.tar.gz
重启httpd
service httpd restart
查看php模块
在php.ini配置里进行配置
//最好放在extension的位置 extension=yaf.so //在php.ini文件末尾放置 [yaf] yaf.environ = product yaf.library = NULL yaf.cache_config = 0 yaf.name_suffix = 1 yaf.name_separator = "" yaf.forward_limit = 5 yaf.use_namespace = 0 yaf.use_spl_autoload = 0
$php -m
有yaf ,则安装成功!
接下来,使用代码生成工具生成一个domo
访问yaf在github上的地址https://github.com/laruence/php-yaf
下载zip包,解压,进入yaf目录/tools/cg
cd /home/lixianghui/Downloads/php-yaf-master/tools/cg
$yaf_cg Sample
会生成一个Sample目录,然后复制到/var/www/html/ 目录下,浏览器http://ip/Sample/ 运行。
Hello World! I am Stranger
参考:
http://www.cnphp6.com/archives/74150
http://php.net/manual/en/book.yaf.php
https://github.com/super-d2/php-yaf
https://pecl.php.net/package/yaf
http://aicode.cc/article/381.html