Bookcafe

Wednesday, February 22, 2012

My First Application in Yii Part 2

Now, we go into serious matter in Yii, and I would like to create the simplest application as described in the Yii website tutorial. I going to use Yiic.php at the command prompt to create my first application named azmipelahtest in the C:\xampp\htdocs and shown as follows:



As shown above I just typing php yiic.php webapp c:\xampp\htdocs\azmipelahtest
Now I can access my fisrt Yii application using my IE browser at http://localhost/azmipelahtest


Monday, February 20, 2012

My First Application in Yii

Yii is a PHP Framework which works similarly to CakePHP. I manage to put some effort to read and train myself using the Yii framework. When you visit the Yii websire, you will find it is very interesting that to setup Yii just take about 3 steps.


Step 1 : Create Database 
Step 2 : Auto generated Base PHP Code uisng Yiic.php 
Step 3 : Customise the codes


 In my case I'm using xampp even though I found out that the lastest version of xampp 1.7.7 has issues in windows XP Sp3. I have tried to install xampp version 1.7.7 so many times and at the apache failes to start up. So I tried the previous version of xampp 1.7.4 and finally I manage to start the apache web server and build my first Yii application.


I installing my XP Sp3 in Windows Virtual PC on top of my Windows 7 Pro. Files transfer between the host and the guest sometimes makes corrupted files. I need to use the Md5 string to make sure the my transferred files are not corrupted.


Actually at first, I'm having problem in setting up the phpmyadmin root password. I need to use the following to set the root password (PLEASE REMEMBER DO THIS FIRST BEFORE DOING ANYTHING ELSE).


C:/xampp/mysql/bin> mysqladmin -u root password NEWPASSWORD
** The above commands will set your root to have password.

However, if you want to change (or update) a root password, then you need to use the following command:
C:/xampp/mysql/bin> mysqladmin -u root -p'oldpassword' password newpassFor example, If the old password is azmi, you can set the new password to azmiabc, enter:
C:/xampp/mysql/bin> mysqladmin -u root -p'azmi' password 'azmiabc'
AND PLEASE SET YOUR CONFIC.INC.PHP to the following configuration


/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['user'] = 'root'; 
$cfg['Servers'][$i]['password'] = ''; 
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


DO NOT TRY TO CHANGE YOUR ROOT PASSWORD FROM THE PHPMYADMIN USER INTERFACE SINCE THE PASSWORD SHOULD BE ENCRYTED AND CANNOT BE TYPED DIRECTLY IN THE PASSWORD FIELD UNDER THE MYSQL->USER TABLE.


I have to make sure that PHP is native to the windows environment to make sure that any PHP files can be run under DOS command prompt so I do the following under Computer ->Advance System Settings



The go to Advanced tab, select Environment Variables..



Select TMP then Path and select Edit ... as shown above


Key in in the Variable value ;c:\xampp\php then click OK and restart your PC. Then test your setting by going to the command prompt and key in php -v the result should (at least) like the following: