yaf框架搭建
有服务器时:
直接进入root模式
直接cd ~
https://lnmp.org/install.html
方式安装即可
安装完成则使用cd /
lnpm
查下什么在跑
lnmp status
ps aux|grep 163
查看进程号
安装yaf
http://pecl.php.net/
http://pecl.php.net/package/yaf
copy它的地址
cd ~
wget 'http://pecl.php.net/get/yaf-3.0.5.tgz'
tar zxvf yaf-3.0.5.tgz解压
解压进入
cd yaf-3.0.5.tgz这里是yaf的原代码 ls
怎么编译呢?
在yaf-3.0.5.tgz目录执行: phpize
然后多了个configure文件
.这个文件是需要编译的
执行: ./configure --with-php-config=/usr/local/php/bin/php-config
下一步
执行:make //开始编译
然后find ./ -name 'yaf.so';
你会发现有一个这个文件,这就是yaf扩展文件
执行:make install
会出现 /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/
这个就是把yaf扩展复制到php这个地址里
然后直接进入
vim /usr/local/php/etc/php.ini
在这个文件最尾部加上
[Yaf]
extension=yaf.so //加上这个扩展
yaf.environ="product"//生产环境
保存退出
然后就装好yaf环境了
lnmp restart重启lnmp
cd /
lnmp vhost add 增加一个项目
项目名:itbull.com
是否使用别名:n
放置的目录:/home/work/itbull
allow rewrite
n
allow access_log
y
access log file :直接回车
是否建立mysql同名:
n
直接回车
lnmp vhost list
cd /usr/local/nginx/conf/vhost/
ls
itbull.com.conf
vim
配置完直接执行
lnmp restart
server
{
listen 80;
#listen [::]:80;
server_name 192.168.153.128;
index index.php;
root /home/work/itbull;
include enable-php.conf;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
} //这是yaf要用的正则
access_log /home/work/itbull/logs/itbull.com.log;
}
下载yaf项目:
在github上
搜索yaf
复制zip链接
https://github.com/laruence/yaf/archive/master.zip
进入自己目录
mkdir tmp //新建一个临时目录
cd tmp/
ls
wget https://github.com/laruence/yaf/archive/master.zip
unzipmaster.zip //解压
会出现一个yaf-master目录
cd yaf-master
cd tools/
cd cg/
在这个目录执行
:./yaf_cg //会生产yaf最简单代码
:./yaf_cg itbull 取个名字
注意://这里会出现三个命令没打开,是因为要在php.inidisable_functions把这几个删掉
cd output/
ls
itbull这里面就是刚刚生产的代码
cd /home/work/itbull/我们项目目录
cp -rf tmp/yaf-master/tools/cg/output/itbull/* ./复制那些代码
进入项目目录,就可以了!