Thursday, July 10, 2008

How to install CakePHP in XAMPP

Cake is a PHP web development framework which employs the MVC model. I will describe how to set it up on a win32-based machine.

First install xampp which consists of Apache, PHP, and MySQL. The install process just copies some files to a specified folder.

Next, run “setup_xampp.bat” located on the root xampp folder.

After that open “httpd.conf” located on “apacheconf” folder. Then uncomment the line that contains “mod_rewrite”. This is needed to enable Cake’s pretty URL such as “http://localhost/cake/users/view” instead of “http://localhost/cake/index.php/users/view”.

Afterwards, extract Cake somewhere in the “htdocs” folder. I usually put it in “htdocscake”.

The last step is to copy “database.php.default” in “appconfig” of Cake’s folder to “database.php”. Then change the “$default” variable to suit your database settings. An example is:

class DATABASE_CONFIG

{

var $default = array('driver' => 'mysql',

'connect' => 'mysql_connect',

'host' => 'localhost',

'login' => 'root',

'password' => '',

'database' => 'test',

'prefix' => '');

}

Which works with the default MySQL in xampp.

To see if things are working properly, run “xampp-control.exe” in xampp’s root folder and then start Apache and MySQL from there:

After that point your browser to “http://localhost/[cake's root folder]” for example “http://localhost/cake”. and enjoy CAKE

14 comments:

  1. Hi Mr. Narendra, Thanks alot for the information. Could u pls leave a blog on integration of chatting support in a web site . that will be helpful.

    thanks

    ReplyDelete
  2. I did everything to precision what you said and am still getiing "Page Not found" error.

    Assumtions: my directory looks like this:

    xampp
    htdocs
    htdocscake
    app
    config
    database.php

    or does htdocscake have to be name cake?

    Pittore

    ReplyDelete
  3. Hi Pittore,
    Put this cake directory in htdocs directory.
    hope this works
    good luck

    ReplyDelete
  4. Update: entire cake directory needs to be put in htdocs

    ReplyDelete
  5. Hello, I found your blog in a new directory of blogs. I don’t know how your blog came up, must have been a typo. Your blog looks good, have a nice day.
    PHP Website Development Company India

    ReplyDelete
  6. @wildnet, Thanks for stopping by and for your comment. It is not a typo that my blog is listed in a directory.

    ReplyDelete
  7. hello sir,
    after installing as per your guidence ,i face this kind of error.

    Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\cake\libs\debugger.php, line 674]
    Notice (1024): Please change the value of 'Security.cipher_seed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 678]
    Your tmp directory is writable.

    The FileEngine is being used for caching. To change the config edit APP/config/core.php

    Your database configuration file is present.

    Cake is able to connect to the database.

    pls suggest suitbale steps to run cake.

    ReplyDelete
  8. @Sunny,
    Plz change the value of Security.salt and Security.cipher_seed in app/config/core.php to any other value. These are security keys to enhance the security of your application.

    Thanks for your comment and stopping by this link.

    ReplyDelete
  9. thanks Narendra for ur support. can u pls provide me some link where i download good cakephp manual or book . i m new to this ,so want to learn it.

    ReplyDelete
  10. I got help from http://book.cakephp.org/ and a cakePHP book(https://www.packtpub.com/cakephp-application-development/book).

    Hope it helps..

    ReplyDelete
  11. I have pasted this mail along with the answer as more people can benefit.

    Question:

    Hello Sir,
    I saw ur blog regarding cake PHP installation.

    Im new for cakePHP. Im trying to install it in Windows 7 with XAMPP.

    I did all configurations. I corrected /cake/app/config/database.php

    class DATABASE_CONFIG {

    var $default = array(
    'driver' => 'mysql',
    'host' => '192.168.100.152',
    'login' => 'DB',
    'password' => 'xxxxx',
    'database' => 'cake',
    'prefix' => '',
    );

    var $test = array(
    'driver' => 'mysql',
    'host' => '192.168.100.152',
    'login' => 'DB',
    'password' => 'xxxxx',
    'database' => 'cake',
    'prefix' => '',
    );
    }

    I got Cake is NOT able to connect to the database.

    Will u help me to fix it?

    I can connect with mysal by using PHP. But i cant in CakePHP. Plz help me sir....

    Thanks in Advance


    Ans:
    1. Edit app/config/core.php and raise debug to 2 to get better error reporting.

    2. Check app/config/database.php and ensure that there is no typo.

    3. you can check your apache and mysql log files also.

    ReplyDelete
  12. Thanks for this valuable post. Its really a helpful and effective post. I appreciate this kind of information.
    Seo Company In India | PHP Development India

    ReplyDelete
  13. sir,plz help me out..
    this error is coming..

    Cake is NOT able to connect to the database.

    Database connection "Mysql" is missing, or could not be created.

    ReplyDelete
  14. Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\cake\libs\debugger.php, line 674]
    Notice (1024): Please change the value of 'Security.cipher_seed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 678]
    Your tmp directory is writable.


    what value should i change for cipherseed and salt in core.php?

    ReplyDelete

How to install PHP7.x, MySQL5.7 on Ubuntu 16.x

Open the terminal >sudo apt-get update >sudo apt-get install php-mbstring php7.0-mbstring php-gettext apache2 mysql-server-5.7 m...