Windows10安装配置yaf

一,Windows10安装配置yaf

下面有nginx与Apache的站点配置

​ Yaf官方文档:http://www.laruence.com/manual/index.html

第一步:安装PHP扩展配置Yaf

在这里插入图片描述

下载Yaf扩展:http://pecl.php.net/package/yaf
在这里插入图片描述
在这里插入图片描述


   None-Thread Safe    就是非线程安全,在执行时不进行线程(thread)安全检查; 
   Thread Safe         就是线程安全,执行时会进行线程(thread)安全检查,
                       以防止有新要求就启动新线程的 CGI 执行方式耗尽系统资源。

  non-thread-safe      非线程安全 与 IIS搭配环境 
  thread-safe          线程安全 与 apache搭配环境 
第二步:下载解压包,将 php_yaf.dll 拷贝至 php环境的 ext目录 下

php.ini

 ;php_yaf
 extension=php_yaf.dll

重新启动Apache,查看phpinfo()信息,如下图表示扩展安装成功

<?php
   echo  phpinfo();

在这里插入图片描述

二,yaf 生成 PHP框架

1, 在Github下载Yaf项目生成目录压缩文件 在Github下载Yaf项目生成目录压缩文件

Github下载地址:https://github.com/laruence/yaf

2, 解压后在 yaf-master\yaf-master\tools\cg 目录下
按住 Ctrl + shift 在右键打开 Windows PowerShell

  PS E:\yaf\tools\cg>  php yaf_cg  项目名(yaf_test)

在 E:\yaf\tools\cg\output\中生成 一个项目文件夹(便是PHP框架)
在这里插入图片描述
3, apache 配置 ( yaf_test = 项目名 )

配置文件: E:\wamp64\bin\apache\apache2.4.35\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
  ServerName  www.vue_plan.com
  ServerAlias vue_plan.com
  DocumentRoot "E:/wamp64/www/projects/vue_plan"
  <Directory "E:/wamp64/www/projects/vue_plan">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
     Require local
  </Directory>
</VirtualHost>

nginx 配置站点:
位置 : vim /etc/nginx/nginx.conf

server {
		listen                80;                   # 端口号
		server_name  www.vue_plan.com vue_plan.com; # 站点域名
		root         /var/www/html;                 # 站点读取目录
		index index.html index.htm index.php;       # 默认读取文件
		localtion / {
		}
		location ~ .php${
			fastcgi_pass   127.0.0.1:9000;
			fastcgi_index  index.php;
			fastcgi_param  SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; # 站点会以这里为标准读取
			include fastcgi_params;
		}
		error_page 404 /404.html;
			location = /40x.html{
		}
		error_page 500 502 503 504 /50x.html
			location = /50x.html{
		}	
	}

server {
    listen       80;                            # 监听端口
    server_name www.vue_plan.com vue_plan.com;  # 站点域名
    root  /var/www/html;                        # 站点根目录
    index index.html index.htm index.php;       # 默认导航页
 
    location / {
        # WordPress固定链接URL重写
        if (!-e $request_filename) {
            rewrite (.*) /index.php;
        }
    }
 
    # PHP配置
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }
}

上面的配置不行,看这个实例

server {
    listen       80;
    server_name  www.vue_plan.com;
    root      /var/www/html;  
    index index.php index.html index.htm;

    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php last;
    }

    location ~ \.php$ {
       fastcgi_pass   php;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include        fastcgi_params;
    }
}

在Nginx上配置多个站点 https://www.cnblogs.com/Erick-L/p/7066564.html

4, host Windows10 配置
位置: C:\WINDOWS\System32\drivers\etc\host

  127.0.0.1   www.vue_plan.com     

在这里插入图片描述
4,yaf框架目录结构

+ public
  |- index.php //入口文件
  |- .htaccess //重写规则    
  |+ css
  |+ img
  |+ js
+ conf
  |- application.ini //配置文件   
+ application
  |+ controllers
     |- Index.php //默认控制器
  |+ views    
     |+ index   //控制器
        |- index.phtml //默认视图
  |+ modules //其他模块
  |+ library //本地类库
  |+ models  //model目录
  |+ plugins //插件目录

具体方法参考鸟哥的文档:

http://www.laruence.com/manual/tutorial.firstpage.html#tutorial.directory

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值