yaf下载地址:http://code.google.com/p/yafphp/
找到自己PHP版本对应的yaf后下载,如:php_yaf-2.1.17-x86-5.2.17-nts-nodebug.dll5.2.17就是php版本
将dll文件放到php的ext目录下
配置php.ini
增加行:extension=php_yaf-2.1.17-x86-5.3.4-zts-nodebug.dll
重启之后,你就可以看到phpinfo()中就输出了yaf项
nginx.conf配置
#yaf.dev.com
server {
listen 80;
server_name yaf.dev.com;
root D:/yaf;
charset utf-8;
error_log logs/erro-for-rewriter-8077.log notice;
rewrite_log on;
location / {
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
error_page 404 /index.php;
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root D:/yaf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME D:/yaf$fastcgi_script_name;
include fastcgi_params;
}
}
}
再创建如下这些文件即可出现"hello world!":
1. index.php
<?php
define("APP_PATH", dirname(__FILE__));
$app = new Yaf_Application(APP_PATH . "/conf/application.ini");
$app->run();
2. .htaccess (注意文件名有“.”)
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
#.htaccess, 当然也可以写在httpd.conf
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php
</IfModule>
3. conf 目录
4. conf/application.ini
[product]
;支持直接写PHP中的已定义常量
application.directory=APP_PATH "/application/"
5. application 目录
6. application/controllers 目录
7. application/library 目录
8. application/models 目录
9. application/modules 目录
10. application/plugins 目录
11. application/views 目录
12. application/controllers/Index.php
<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
}
}
13. application/views/index 目录
14. application/views/index/index.phtml
hello world!