Monday, July 20, 2015

install yii1 framework using command line


download yii zip file
extract in your htdocs or www directory (named as yii_framework)

Now in terminal
php yii_framework/framework/yiic webapp projectname

now your new Yii project is ready to development.

update your main.php file upder path "/protected/config"

uncomment your urlManager block.

connect to your database
comment your db array that contain sqlite statement with a file and add a array given below.

array(
        'connectionString' => 'mysql:host=localhost;dbname=testdb',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
        'tablePrefix' => '',// if you use any prefix for all tables in your database
    )

now your yii is connected with your database

add a .htaccess on project's root directory file for using your defined controller action.
----------
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php
----------

0 comments:

Post a Comment