November 20, 2014

November 20, 2014
In thia article, we are going to discuss about How to install CakePHP on Ubuntu 14.04. CakePHP uses well-known software engineering concepts and software design patterns, as Convention over configuration, Model-View-Controller, Active Record, Association Data Mapping, and Front Controller.

Steps are almost same but in Windows we did that using GUI or in Windows Explorer and in Ubuntu we'll do it through terminal or you can say using commands.

Step 1:

Open the command prompt (terminal) and type the following command

cd /var/www/html

Step 2:

Type the below command to download the cakephp.

$ sudo wget

where 2.5.2 is the latest stable version of CakePHP.

Step 3:

Use the following command to unzip the downloaded zip file.

$ sudo unzip 2.5.2

Step 4: 

Rename extracted folder.

$ mv cakephp-cakephp-736e999/ cake

where cakephp-cakephp-736e999 is the name of extracted folder.

To run CakePHP on browser use this path localhost/cake.

Step 5: 

Go to cake folder.

$ cd cake

And change permissions to app/tmp folder.

$ sudo chown -R root:www-data app/tmp
$ sudo chmod -R 775 app/tmp

Step 6: 

To make script writable perform these steps:

$ apache2clt -M

If you see mod_rewrite in the list shown then script is writable. If not then to enable it type this command:

$ a2enmod rewrite

Step 7: 

Type cd /etc/apache2

$ sudo nano  apache2.conf

Set these lines in the file:

<Directory /var/www>
Option Indexes FollowSymlinks
AllowOverride All
Required all granted

Press ctrl+x, then press y and enter to save the file.

Restart apache:

$ sudo service apache2 restart

Step 8: 

Now go to app/Config

$ cd /var/www/html/cake/app/Config
$ sudo mv database.php.default default.php

Refresh localhost/cake page. Now database file is detected but still we have to create a database as it will show could not connect to database.

Step 9: 

Open localhost/phpmyadmin on browser. Login using your username and password and create a database named as cake. After this edit database.php file.

$ sudo nano database.php

Set host as localhost, username is your phpmyadmin username, password is your phpmyadmin password and database name.

Refresh localhost/cake page. Now database is detected.

Step 10: 

To remove the salt and seed error shown on top of the localhost/cake page we have to edit core.php file.

$ sudo nano core.php

Find this section and replace both the strings with any random strings or you can use these strings also.

/* A random string used in security hashing methods. */
Configure::write('Security.salt', 'fvjhdj8fvn85grg73fbrvfn9fjFGfnhvt758nADG');
/* A random numeric string (digits only) used to encrypt/decrypt strings. */
Configure::write('Security.cipherSeed', '55857485748594575784348784787475');

Then press ctrl+x, press y and enter to save file.

Refresh localhost/cake page. And its done.


Post a Comment