The Fast, Secure and Professional PHP Framework . Yii is a high-performance PHP framework best for developing Web 2.0 applications. Download the latest version of the YII Framework. Extract the file which will have YII Library files. Don’t modify these codes as it will be used as library.
Check the system requirement by running http://localhost/nachi2013/yii_library/requirements/ as per your folders.
Create a Web Application
Open the terminal run the following code to create a web application
php /var/www/nachi2013/yii_library/framework/yiic.php webapp /var/www/request_folder
your application will be created on your requested folder
To give you an initial experience with Yii, in this section we describe how to create your first Yii application. We will use yiic (command line tool) to create a new Yii application and Gii (powerful web based code generator) to automate code creation for certain tasks. For convenience, we assume that YiiRoot is the directory where Yii is installed, and WebRoot is the document root of our Web server.
Connecting the Database
The next step is to connect the database with our application . Go to the following page in your requested folder. requested_folder/protected/config/main.php
and uncomment the following to use a MySQL database
'db'=>array( 'connectionString' => 'mysql:host=localhost; dbname=testdrive', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', ),
Enter the db details and save the file. Now your mysql was connected to our YII application.
Hello world Application
In the same folder, we can also change the application name which was given as
'name'=>'My Web Application',
Let’s name it as 'Hello world '. The title will change as follows.
'name'=>'Hello world',
We have created out first hello world application in YII.
No comments:
Post a Comment