Yii2.0教程入门篇 —— 安装配置
2015-01-27 00:00
1181 查看
说明: Yii2.0需要PHP5.4+版本
下载&安装:
使用Composer安装
下载文件安装
下载地址:http://www.yiiframework.com/download/
或者从github下载最新版本:https://github.com/yiisoft/yii2
解压下载到的压缩文件,进入apps/basic/config/web.php,修改cookieValidationKey:
验证安装:
(PS:假定使用basic版本)
如果安装成功的话,出现如下界面:
否则进入basic目录,运行如下命令:
查看是否满足系统需求。
配置web服务器:
Apache
Nginx
下载&安装:
使用Composer安装
composer global require "fxp/composer-asset-plugin:1.0.0-beta4" composer create-project --prefer-dist yiisoft/yii2-app-basic basic
下载文件安装
下载地址:http://www.yiiframework.com/download/
或者从github下载最新版本:https://github.com/yiisoft/yii2
解压下载到的压缩文件,进入apps/basic/config/web.php,修改cookieValidationKey:
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'enter your secret key here',
验证安装:
http://localhost/basic/web/index.php
(PS:假定使用basic版本)
如果安装成功的话,出现如下界面:
否则进入basic目录,运行如下命令:
php requirements.php
查看是否满足系统需求。
配置web服务器:
Apache
DocumentRoot "path/to/basic/web" <Directory "path/to/basic/web"> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php </Directory>
Nginx
server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name mysite.local; root /path/to/basic/web; index index.php; access_log /path/to/basic/log/access.log main; error_log /path/to/basic/log/error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php?$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #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; } }
相关文章推荐
- Yii2.0 图文安装配置教程
- Android SDK 2.0安装、配置图文教程
- LDAP在windows下配置及安装&入门教程
- Storm入门教程:Storm安装配置步骤详解
- Windows 2008 R2 Hyper-v 2.0安装和入门配置
- Node.js入门教程:在windows和Linux上安装配置Node.js图文教程
- Android SDK 2.0安装(配置图文教程)
- Ant入门教程之安装配置
- Yii2.0教程入门篇 —— 运行应用
- 【OpenCV入门教程之一】 安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
- 《Visual C++ 2010入门教程》系列二:安装、配置和首次使用VS2010(转)
- WIN08 R2 Hyper-v 2.0安装和入门配置 推荐
- Yii入门教程之Yii安装及hello world
- 《Visual C++ 2010入门教程》系列二:安装、配置和首次使用VS2010
- 《Visual C++ 2010入门教程》系列二:安装、配置和首次使用VS2010
- 《Visual C++ 2010入门教程》系列二:安装、配置和首次使用VS2010
- 【军哥谈CI框架】之入门教程之第一讲:codeigniter的介绍和安装配置
- 【OpenCV入门教程之一】 安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
- 【OpenCV入门教程之一】 安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置