Creating Your First Yii Application

Hello everyone. In this tutorial we will be looking at setting up the Yii framework and create our skeleton app step by step. Lets begin.

Firstly, we need to download the Yii framework. This can be done from the Yii Framework website. When the download is complete, unzip the file and you will see a folder containing:

  • demos
  • framework
  • requirements
  • and some legal mumbo jumbo & other stuff

The only folder we are interested in is the framework folder. Copy this folder and go to your localhost. Paste the yii framework folder in a new folder where we are going to setup our application, in this tutorial we are using: localhost/yii-demo

Cool, Now open up your command prompt and navigate to the localhost/yii-demo/framework (e.g : c:\wamp\www\yii-demo\framework

Now type in:  yiic webapp c:\wamp/www/myFirstYiiApp This will ask you if you want to “Create we application under ‘C:\wamp\www\myFirstYiiApp’? [Yes:No]“
We do want to so type in “yes”. Some of you might get an error at this point saying something about php or something like that (great tutorial right?). That simply means you don’t have php setup as an environment variable.

To fix this:
“Open the Environment Variables window by going to: Start -> My Computer (right click!) -> Advanced Tab -> Environment Variables -> Click Path in System variables -> Edit.

In Windows 7, press the Win key and type “env”. You should see a control panel section with a shortcut to “Edit the system environment variables”. Select it and then click on “Environment Variables…”
Click on the variable called PATH and click “Edit…”. Do not delete the paths already there! Separate each path with semicolons.
Now you have to add the following PATHs in Windows: “C:\wamp\bin\php\php5.2.8″ and “C:\wamp\www\yii-demo\framework”. The former path should lead where your php.exe resides, and the latter where your yiic.bat resides.”
That bit is stolen from the Yii wiki page, thanks.
So we have type yes (or simply Y) and we should see a whole bunch of lines of stuff happening and the message “Your application has been created under C:\wamp\www\myFirstYiiApp ”. We have now created our skeleton app.
If you point your browser at localhost/myFirstYiiApp you should see the Yii skleton app. Well done, you have just installed Yii.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s