how to install yii2

1. Install From Archived File

Edit file /var/www/basic/config/web.php, set cookieValidationKey

1
'cookieValidationKey' => 'chuchujie'

2. Call to undefined function mb_strlen

1
Fatal error: Call to undefined function mb_strlen()

yum install php55-mbstring module.

Version is import.

3. The directory is not writable by the Web process

1
2
3
4
5
6
7
ec2-user 13898  0.0  0.1 393312 20952 ?        S    19:47   0:00 /usr/sbin/httpd
ec2-user 13900 0.0 0.1 395592 22116 ? S 19:47 0:00 /usr/sbin/httpd
ec2-user 13901 0.0 0.1 393048 20048 ? S 19:47 0:00 /usr/sbin/httpd
ec2-user 13975 0.0 0.1 392024 19528 ? S 19:47 0:00 /usr/sbin/httpd
ec2-user 14493 0.0 0.1 396096 23296 ? S 19:48 0:00 /usr/sbin/httpd
ec2-user 14494 0.0 0.1 392024 19396 ? S 19:48 0:00 /usr/sbin/httpd
ec2-user 14495 0.0 0.0 389784 14824 ? S 19:48 0:00 /usr/sbin/httpd
1
chown -R ec2-user.ec2-user /var/www/basic

http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/

4. Class ‘PDO’ not found

could not find driver Caused by: PDOException

1
2
yum install php55-pdo.x86_64 -y
yum install php-ZendFramework-Db-Adapter-Pdo-Mysql.noarch -y

5. Yii2 Gii Forbidden code 403 You are not allowed to access this page

Edit config/web.php

1
2
3
4
$config['modules']['gii'] = [
'class' => 'yiigiiModule',
'allowedIPs' => ['127.0.0.1', '::1', '10.3xxxx'],
];

Due to company vpn , choose the ip by Apache access log.

http://jeepxiaozi.github.io/yii2xue-xi-bi-ji-xi-lie-6-generating-code-with-giishi-yong-giisheng-cheng-dai-ma.html

6. Yii2 Programing Style

https://github.com/yii2-chinesization/yii2-zh-cn/blob/master/internals-zh-CN/core-code-style.md

7. Reference

https://github.com/forecho/awesome-yii2

8. Tree Manager

http://demos.krajee.com/tree-manager#comment-2288987974