As some of you know, I have long been a fan of the Zend framework ever since working with it on the Industries for the Blind website for a number of years. Recently I decided to look at some of the other frameworks out there in an effort to expand my knowledge and find something more lightweight. After looking at frameworks such as CakePHP, CodeIgniter, Kohanna, Symphony, and Yii, I elected to try out the Yii Framework. The main reasons for this were three-fold. First, Yii seems to be fairly lightweight. Second, it natively runs on PHP5. Third, and probably the biggest draw is the integration with jQuery… jQuery has become one of my favorite software tools over the past six months and I was thrilled to find a framework that natively supported it. Zend’s decision to go with Dojo as their main framework was one of the things that I dislike about Zend.
I started by reading some of the documentation. I decided to install version 1.1 of Yii and downloaded a copy to my PC. Using the Testdriving With Yii documentation I decided to jump right in. For my initial install, I did not want to install in the web root as I have a live site there. Instead I decided to make a folder called “Redesign.” The path to that folder ended up being path_to_public_html/Redesign. However, I did not want to place the Yii Framework in that folder so I would be able to use the same Yii framework for multiple applications. I created a folder at path_to_public_html/yii and placed the unpacked Yii Framework files there.
After some rigmarole with my hosting provider, I was able to get SSH working on my hosting account. I tried the following command from the shell.
/path_to_public_html/yii/framework/yiic webapp /path_to_public_html/Redesign
Initially this did not work, but it was a simple matter of permissions for the file (yiic.) After setting the permissions to an appropriate level I was able to execute the command. The script asks for confirmation and then sets up the initial framework for your application. I then tried to visit the site at Domain/Redesign/index.php but kept getting a 500 error. After much tinkering and combing my server logs I discovered that the problem was my permission on the Redesign folder itself (for whatever reason they were set to 777.) After correcting that problem my new Yii site loaded without a hitch.
Some of the things I really like about this initial installation of the Yii Framework include the following.
- The install is incredibly easy
- You end up with a skeleton complete with working menus, contact form, and login
- The framework itself seems incredibly fast
- There is only 1 file accessible (the bootstrap)
- The bootstrap file itself is very simple
- The documentation worked very well (aside from some errors on my end)
So far my experience with the Yii Framework is very positive. I will continue to post on various things as I go through the process of learning this exciting new tool.
development · framework · jQuery · PHP · Yii
