Saturday, June 18, 2011

Installing CAKEPHP on your ubuntu machine

Hi Everyone,
 
         I'm listing out the steps to install cakephp :

 1. Install the necessary packages using the command
       sudo apt-get install apache2 mysql-server php5

 2. In case you encounter any Lock Error, make sure no other installation is
     happening and close Synaptic Package Manager if open. Even if the problem
     exists, execute sudo killall apt-get

 3. Enable Mod-rewrite: sudo a2enmod rewrite

 4. Download the latest stable version of cake from http://cakephp.org/ and save
     it to your machine.

 5. Extract the downloaded file and rename the extracted folder with your project
     name(assume, project name is cakephp) and move it to the document root
     (most of the times it will be /var/www/)


 6. Give writable permission to tmp folder:
     sudo chmod -R 777 cakephp/app/tmp

 7.  Open file /etc/apache2/sites-enabled/000-default  using command
       sudo vim /etc/apache2/sites-enabled/000-default
       and change AllowOverride None to AllowOverride All.
     i.e, change the following content 
     <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
     </Directory>
                            TO
     <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>
 
 8. Create .htaccess file inside the project directory
    sudo vim.tiny /var/www/cakephp/.htaccess
     and add these contents:
     RewriteEngine on
    RewriteRule    ^$ app/webroot/    [L]
    RewriteRule    (.*) app/webroot/$1 [L]


 9. Restart Apache: sudo /etc/init.d/apache2 restart
 Cakephp installation is now complete. Open http://localhost/cakephp from
 browser.

 If in case, you have an error 
 " Your database configuration file is NOT present" after installing
  then execute the following command : 
  sudo aptitude install php5-mysql
  and restart the apache service.

 Guided by Arjun Urs(http://arjunurs.blogspot.com/)

2 comments:

  1. Thanks! Thats a nice one.

    After doing all the steps still I faced URL rewrite in my Cake app and I resolved by executing the below command

    "sudo a2enmod rewrite"

    And restart apache service

    "sudo /etc/init.d/apache2 restart"

    All done! Your CakePHP should work fine now.

    ReplyDelete