Home  >  Article  >  Backend Development  >  (19) Configuring the yaf framework under Mac

(19) Configuring the yaf framework under Mac

WBOY
WBOYOriginal
2016-07-29 08:59:031391browse

Machine: mac

Server: nginx
yaf version: 2.3.5
If you don’t know how to join yaf under mac nginx, there are also instructions on the github below
Step one, get the code
You can get the code from the following two places. You can see Here are:
(1), http://www.laruence.com/manual/index.html
(2), https://github.com/laruence/yaf
In addition, because my computer is a mac, I can directly
$ wget https://github.com/laruence/yaf/archive/master.zip#Get the file
$ unzip master.zip # Unzip
$ cd yaf-master/tools/cg # Go to cg to get the source code
#That’s it Execute yaf_cg in php command mode to create a Sample file. Here it depends on where your local php bin/php is and then execute it.
$ php yaf_cg Sample
# The location where the file is generated is in yaf-master/tools/cg/output. There is a Sample This file name is created based on what you enter. You can also specify the directory location such as: /webroot/yaf
I also obtained php-yaf-doc, which is equivalent to the inherited class library. This is the address, which is also available on github, https ://github.com/elad-yosifon/php-yaf-doc I won’t go into details here.
Step 2, configure nginx
erver {
charset utf-8;
client_max_body_size 128M;
listen 80; #I am using port 80 here, if yours is occupied, you can switch to other ports
server_name www.yaf.com; #Configure the domain name yourself, remember to modify hosts after configuration
root /webroot/Sample;#Your own code location, mine is Sample
index index.php;
access_log /webroot/logs/yaf_access.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
} try_files $ uri =404;
}
#error_page 404 /404.html;
location ~ .php$ {
  include fastcgi.conf;
  fastcgi_pass 127.0.0.1:9000;
      #fastcgi_pass unix :/var/run/php5-fpm. SOCK; y Try_files $ uri = 404;
}
local ~ /. (ht| svn|Git) {
Deny all;
}}
# Do not hurry to access the page after the configuration is completed, we also need to restart nginx
sudo ourselves The file path/nginx/bin/nginx -t
# If the configuration is ok and there is no problem, you can restart
sudo Your own file path/nginx/bin/nginx -s reload
# Then check whether the service is started
ps -ef | grep nginx
Step 3, modify php.ini
We initially configured yaf by adding the yaf extension
extension=yaf.so
yaf.environ="product" #Retrieve environment, no need to join if it was added from the beginning
If Remember to modify */php/sbin/php-fpm restart to restart php
The fourth step is to access the domain name
www.yaf.com I configured above, and the result returned by the page is.
Hello World! I am Stranger
If it doesn’t show, check the php logs.
Please indicate the source when reprinting: http://blog.csdn.net/arthuralston2015/article/details/50881799

The above has introduced (19) how to configure the yaf framework under Mac, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn