After playing with the default web application in TurnKey Linux: Yii Framework, I try to create my own with yiic. It’s like MFC Application Wizard which helps to create a simple application for you.
Use yiic in TurnKey Linux
First, SSH to TurnKey Linux: Yii Framework. yiic is located in /var/www/yiiframework/protected. You must change file permission to 755 before running directly.
#chmod 755 yiic
If you are going to create a web application name ‘demo’, use following command:
#yiic webapp /var/www/demo
Or you may use yiic.php with PHP command line interpreter instead.
#php /var/www/yiiframework/protected/yiic.php webapp /var/www/demo2
Change Directory and File Permission
Because we SSH as root, the web application are all belong to root, too. I preferred to change directory and file permission to www-data though they are still accessible by Apache.
# chown www-data:www-data demo -R
Change Apache Virtual Host
May I launch it now? Not yet.
Use https://virtual machine IP address:12321/ as url to login to Webmin. From top menu, choose [Servers]→[Apache Webserver]. The default Document Root for web application in TurnKey Linux: Yii Framework is /var/www/yiiframework/. Change it to /var/www/demo.
Remember to Apply Changes after modification.
Launch your Demo
Now, you may see your new demo site by using http://virtual machine IP address/ as url. You may notice in the front page, the View file information changed from /var/www/yiiframework/protected/views/site/index.php to /var/www/demo/protected/views/site/index.php.
Enable Gii
Edit /var/www/demo/protected/config/main.php to remove comments in ‘modules’=>array(), set your new password in ‘password’, and change ‘ipFilters’ to false:
'modules'=>array( // uncomment the following to enable the Gii tool 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'demo', // If removed, Gii defaults to localhost only. Edit carefully to taste. //'ipFilters'=>array('127.0.0.1','::1'), 'ipFilters'=>false, ),
You may access Gii with http://virtual machine IP address/index.php?r=gii without problems. If you are interested in it, read Play Yii Framework with TurnKey Linux for more how-to.
Thoughts
I am surprised with these generators. They are helpful to build a database prototype. It should help first-time developer to learn from using them.
Reference
- Apache
- Microsoft Developer Network: MFC Application Wizard
- PHP.net
- Play Yii Framework with TurnKey Linux
- TurnKey Linux
- TurnKey Linux: Yii Framework
- Webmin
- Wiki: Create, read, update and delete
- Wiki: IP address
- Wiki: Secure Shell
- Wiki: Uniform resource locator
- Wiki: Virtual machine
- Yii Framework
- Yii Framework: Tutorials: Creating Your First Yii Application
- Yii Framework: Tutorials: Automatic Code Generation
- ZurmoCRM