We would be covering the following topics in this series
- Installing and Configuring CakePHP
- Understanding MVC
- Creating a simple blog
- Adding advanced features to your blog – Understanding Models, Views, Controllers in Depth
- Understanding Helpers
- Ajaxifying comments, adding content summary and Gravatar to your blog
- Securing your blog
In this article, we’ll just take a look at installing and configuring CakePHP.
Download the latest version of CakePHP framework from CakePHP.org. Make sure to download the stable release and not the release candidate.
Unpack the contents of the Cake archive inside the “www” folder of wamp or mamp directory.You now have a folder in your document root named after the release you’ve downloaded. We will rename this
folder to “newblog” (or you can have any name of your choice) . The directory structure inside this folder should look something like this:
We would be doing all our work inside the app folder. The cake folder stores all the core functions for CakePHP. Make sure that you do not edit anything inside this folder. The vendors folder is where youíll place third-party PHP libraries you need to use with your CakePHP applications.
You will notice that there are several other folders inside the app folder. We will take a look at each of them as we go on developing our blog.
Configuring Cake PHP
Configuring Cake PHP is pretty easy. Go inside the app –> Config folder and open the database.php.default file with your favorite editor. Scroll down to the following array in the file:
< php var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'username', 'password' => 'password', 'database' => 'databasename', 'prefix' => '', ); ?>
Enter your login, password, database name and save the file as database.php. That’s it!
Open you browser and go to http://localhost/cakephp. You should now see the following success page:
However, you might see a colorless page like this:
It means that rewrite_module is not enabled in your Apache Server. To do so, click on the wampserver icon in your system tray and go to Apache–>Apache modules and click on the rewrite_module in the list to enable it. It should work fine after rewrite_module has been enabled.
So, now that you’ve CakePHP up and running, we’ll move on to the next step in subsequent article. Do leave your comments if you’ve any doubts regarding this article.