(19th) configure the yaf framework in Mac

Source: Internet
Author: User
: This article describes how to configure the yaf framework in Mac (19th). If you are interested in the PHP Tutorial, refer to it. Machine: mac

Server: nginx
Yaf version: 2.3.5
If you do not know how to add yaf to mac nginx, it is also described on github below.
Step 1. get the code
You can get the code in either of the following two places:
(1), http://www.laruence.com/manual/index.html
(2), https://github.com/laruence/yaf
In addition, because my computer is mac
$ Wget https://github.com/laruence/yaf/archive/master.zip#get the file
$ Unzip master.zip # decompress
$ Cd yaf-master/tools/cg # obtain the source code in cg
# That is, run yaf_cg in php command mode to create a Sample file. here you will see where your php bin/php is and then execute
$ Php yaf_cg Sample
# The file is generated at yaf-master/tools/cg/output. there is a Sample file name. you can specify the directory location based on the file name you entered, for example,/webroot/yaf.
I have also obtained the class library inherited by php-yaf-doc, which is also available on github at https://github.com/elad-yosifon/php-yaf-dochere.
Step 2: Configure nginx
Erver {
Charset UTF-8;
Client_max_body_size 128 M;
Listen 80; # Here I use port 80. if you are in use, you can switch to another port.
Server_name www.yaf.com; # configure the domain name by yourself. remember to modify the hosts after the configuration.
Root/webroot/Sample; # your own code location. mine is Sample.
Index. php;
Access_log/webroot/logs/yaf_access.log;
Location /{
Try_files $ 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;
Try_files $ uri = 404;
}
Location ~ /\. (Ht | svn | git ){
Deny all;
}
}
# Do not worry about accessing the page after the configuration is complete. we also need to restart nginx
Sudo's own file path/nginx/bin/nginx-t
# If the configuration is OK, restart the instance.
Sudo's own file path/nginx/bin/nginx-s reload
# Check whether the service is started.
Ps-ef | grep nginx
Step 3: modify php. ini
We first added the yaf extension when configuring yaf.
Extension = yaf. so
Yaf. environ = "product" # search environment. you do not need to add it if you have joined the environment from the very beginning.
If you want to modify it, remember to */php/sbin/php-fpm restart to restart php.
Step 4: Access the domain name
The result returned by the page is www.yaf.com configured above.
Hello World! I am Stranger
If not displayed, check the php log.
Reprinted please indicate the source: http://blog.csdn.net/arthuralston2015/article/details/50881799

The preceding section describes how to configure the yaf framework in Mac (19th), including related content. I hope to help my friends who are interested in PHP tutorials.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.