5 Mins – Quick Setup Guide To Run CakePHP On Windows 7

Aafrin October 10, 2010 29

In this tutorial, I will be guiding you on how to set and run the CakePHP framework on Windows 7. For those who have not heard of CakePHP before, it is an open source web application framework for producing web applications. It is written in PHP, modeled after the concepts of Ruby on Rails, and distributed under the MIT License. More information can be found on their official website here.An online IT degree is what some people pursue when they want to learn more about computer software and security.

Before starting the tutorial, please check whether the prerequisite listed below has been completed.

  • Web Server With PHP & mySQL (Recommended Xampp Or Wamp).
  • 25 mb of free space — for the CakePHP files.
The Tutorial.

1. Visit the CakePHP download archive in GitHub here and download the latest stable version. Download the files .zip format since we will be setting it on Windows operating system.

2. Once the download completed, extract the files and copy the files into the web server www root. You should place the folder as shown in the image below. The folder’s name can be changed as you wished and doesn’t required to be named as cake in order to run it. Do not start the server yet , there are some configuration needed to be done on the Apache core files before running the CakePHP framework.

3.  If you have installed a bundled web server like Xampp or Wamp, navigate to the Apache folder within your web server. On the other hand, if the installation was made separately, locate the Apache installation folder. Then, navigate to the conf folder which is located within the Apache main folder.

4. Next, open the httpd.conf file which is in the conf folder. Open it using notepad or any other text based editor. The file will display contents like shown in the image below.

5. Find the code below and uncomment it. This is to enable the rewrite module on the apache. By default it is turned off in some web servers. If it is already uncommented you can continue to the next step.

Locate this code and remove the ‘#’ which is located in front of the line.

#LoadModule rewrite_module modules/mod_rewrite.so

The modified code should look like this. Save and close the file, upon completing the modification

LoadModule rewrite_module modules/mod_rewrite.so

6. Now, start your server and visit the location of the folder via your preferred Internet Browser. Eg. http://localhost/cake/. By now, the default screen for CakePHP should be displayed like below.

Take note: Some of the information displayed on the CakePHP page will show error. You need to make changes in the CakePHP configuration files to fix it. I will try to cover this separately on another article.

29 Comments »

  1. Alisha October 12, 2010 at 1:28 pm - Reply

    I am a newbie and the setup guide on cakephp helped me a lot. Thanks…

  2. surendra December 1, 2010 at 4:12 pm - Reply

    i am using windows 7..i am not getting css and its not working . i copied same thing into xp os .but its working there with css also.

    • Aafrin December 29, 2010 at 9:35 am - Reply

      did you modified the httpd.conf file as mentioned above.

      What web server are you using ?

  3. chanachok December 23, 2010 at 4:22 pm - Reply

    thank you
    I spend more time to fix it.
    thank you

  4. ganjar March 4, 2011 at 2:31 pm - Reply

    Is it work on windows 7 starter edition? If It is, how?

    • Aafrin March 9, 2011 at 11:49 am - Reply

      If i am not mistaken, it should work on the mentioned windows version. Please make sure no application is running on port 80 since it is needed for apache.

      Use compiled server like xampp or wamp instead of installing the php, mysql manually

  5. varun May 1, 2011 at 6:33 pm - Reply

    hello

    Dear, I have windows 7 and wamp server. I did same what you mentioned above but I found error.

    Warning (2): require(C:\wamp\www\cake\libs\dispatcher.php) [function.require]: failed to open stream: No such file or directory [APP\webroot\index.php, line 76]
    Fatal error: require() [function.require]: Failed opening required ‘C:\wamp\www\cake\libs\dispatcher.php’ (include_path=’.;C:\php5\pear’) in C:\wamp\www\cakes\webroot\index.php on line 76

  6. shilpa August 3, 2011 at 10:58 pm - Reply

    i got the following errors:

    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 694]

    Please change the value of ‘Security.cipherSeed’ in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 698]

    Cake is NOT able to connect to the database.

    i’m a newbie, have no clue how to proceed further. Please help

    • Aafrin August 14, 2011 at 12:15 pm - Reply

      Please check your email.

      I have sent some tips and instructions.

      Hope it helps.

      • Hin August 17, 2011 at 4:30 pm - Reply

        Hi Aafrin,

        I have installed CakePHP on top of WAMP and I also got the “Cake is NOT able to connect to the database” error.
        Could you sent the tips to me as well?
        Thank you very much!

        – Hin

        • Aafrin September 9, 2011 at 9:48 am - Reply

          Hi,

          Didi you created a database via phpmyadmin and added the details in the config file ?

      • CV March 13, 2012 at 2:32 am - Reply

        Hi,
        I have the same error. Please advice.

        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 694]

        Please change the value of ‘Security.cipherSeed’ in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\cake\libs\debugger.php, line 698]

        Cake is NOT able to connect to the database.

        • Aafrin May 8, 2012 at 12:27 am - Reply

          Please do change the salt code value on the config file and also update the database connection on the database connection file

  7. Malik Arshad Talokar August 23, 2011 at 6:01 pm - Reply

    I m using windows 7..
    and i need to configure Cakephp 2.0.0 with wamp server…

    I did all above steps but i found this error..

    please help me about it…

    • Aafrin September 9, 2011 at 9:44 am - Reply

      Hi,

      Please let me know, what kind of error you are facing. I will try to troubleshoot for you.

      Hope to hear from you soon.

  8. Adeel December 18, 2011 at 3:01 am - Reply

    i followed the above steps and get the following errors please help me if you can…..

    CakePHP: the rapid development php framework
    Release Notes for CakePHP 2.0.4.
    Notice (1024): Please change the value of ‘Security.salt’ in app/Config/core.php to a salt value specific to your application [CORE\Cake\Utility\Debugger.php, line 713]Code public static function checkSecurityKeys() {
    if (Configure::read(‘Security.salt’) == ‘DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi’) {
    trigger_error(__d(‘cake_dev’, ‘Please change the value of \’Security.salt\’ in app/Config/core.php to a salt value specific to your application’), E_USER_NOTICE);Debugger::checkSecurityKeys() – CORE\Cake\Utility\Debugger.php, line 713
    include – CORE\Cake\View\Pages\home.ctp, line 30
    View::_render() – CORE\Cake\View\View.php, line 598
    View::render() – CORE\Cake\View\View.php, line 365
    Controller::render() – CORE\Cake\Controller\Controller.php, line 900
    PagesController::display() – CORE\Cake\Controller\PagesController.php, line 80
    ReflectionMethod::invokeArgs() – [internal], line ??
    Controller::invokeAction() – CORE\Cake\Controller\Controller.php, line 473
    Dispatcher::_invoke() – CORE\Cake\Routing\Dispatcher.php, line 107
    Dispatcher::dispatch() – CORE\Cake\Routing\Dispatcher.php, line 89
    [main] – APP\webroot\index.php, line 96
    Notice (1024): Please change the value of ‘Security.cipherSeed’ in app/Config/core.php to a numeric (digits only) seed value specific to your application [CORE\Cake\Utility\Debugger.php, line 717]Code
    if (Configure::read(‘Security.cipherSeed’) === ’76859309657453542496749683645′) {
    trigger_error(__d(‘cake_dev’, ‘Please change the value of \’Security.cipherSeed\’ in app/Config/core.php to a numeric (digits only) seed value specific to your application’), E_USER_NOTICE);Debugger::checkSecurityKeys() – CORE\Cake\Utility\Debugger.php, line 717
    include – CORE\Cake\View\Pages\home.ctp, line 30
    View::_render() – CORE\Cake\View\View.php, line 598
    View::render() – CORE\Cake\View\View.php, line 365
    Controller::render() – CORE\Cake\Controller\Controller.php, line 900
    PagesController::display() – CORE\Cake\Controller\PagesController.php, line 80
    ReflectionMethod::invokeArgs() – [internal], line ??
    Controller::invokeAction() – CORE\Cake\Controller\Controller.php, line 473
    Dispatcher::_invoke() – CORE\Cake\Routing\Dispatcher.php, line 107
    Dispatcher::dispatch() – CORE\Cake\Routing\Dispatcher.php, line 89
    [main] – APP\webroot\index.php, line 96
    URL rewriting is not properly configured on your server. 1) Help me configure it 2) I don’t / can’t use URL rewriting

    Your version of PHP is 5.2.6 or higher.

    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 NOT present.
    Rename APP/Config/database.php.default to APP/Config/database.php

    Editing this Page
    To change the content of this page, create: APP/View/Pages/home.ctp.
    To change its layout, create: APP/View/Layouts/default.ctp.
    You can also add some CSS styles for your pages at: APP/webroot/css.

    Getting Started
    New CakePHP 2.0 Docs

    The 15 min Blog Tutorial

    More about Cake
    CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.

    Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.

    •Cake Software Foundation
    ◦Promoting development related to CakePHP
    •CakePHP
    ◦The Rapid Development Framework
    •CakePHP Documentation
    ◦Your Rapid Development Cookbook
    •CakePHP API
    ◦Quick Reference
    •The Bakery
    ◦Everything CakePHP
    •The Show
    ◦The Show is a live and archived internet radio broadcast CakePHP-related topics and answer questions live via IRC, Skype, and telephone.
    •CakePHP Google Group
    ◦Community mailing list
    •irc.freenode.net #cakephp
    ◦Live chat about CakePHP
    •CakePHP Code
    ◦For the Development of CakePHP Git repository, Downloads
    •CakePHP Lighthouse
    ◦CakePHP Tickets, Wiki pages, Roadmap

    • Aafrin January 3, 2012 at 7:48 pm - Reply

      Hi,

      It seems you are having some error on the initial requirement needed to run the framework.

      It says “Please change the value of ‘Security.salt’ in app/Config/core.php to a salt value specific to your application ”

      Please navigate to the mentioned path and add any key that will be used later on for encryptions.

      Also try to fix other error and do update me, if you still face the problem.

      Thank you.

  9. Rajesh January 24, 2012 at 1:58 pm - Reply

    Hiii dude..
    i am using xp & wamp server..i getting no server found url after i created database & baked model,view, controller..wt i do please reply me…

    • Aafrin February 3, 2012 at 9:39 am - Reply

      Hi,

      Have you configured the web server properly? And the path you accessing, is it correct one.

  10. sherin May 12, 2012 at 7:41 pm - Reply

    hi,

    i couldn’t get the css styles and the link not working…..
    eg:localhost/cake/posts/index….

    pls help me…..

    • Aafrin May 19, 2012 at 10:00 am - Reply

      Hi,

      Did you checked the path of your css file ? Where did you placed it

      • sherin May 25, 2012 at 7:32 pm - Reply

        hi aafrin,

        the css file path is,
        wamp\www\cake\app\webroot\css

        is there any prblm…

        help me pls…..

        • Aafrin June 9, 2012 at 4:38 pm - Reply

          Hi,

          Can you zip and send your folder? I will check it and update you what are the erros and how to fix it.

  11. Naeem Akhtar June 14, 2012 at 5:44 am - Reply

    thanks, it really helped. :)

    • Aafrin June 21, 2012 at 5:28 pm - Reply

      You are welcome.. :D

  12. web application development September 21, 2012 at 3:09 pm - Reply

    It is really a nice and helpful piece of info. I’m glad that you simply shared this helpful info with us. Please keep us
    informed like this. Thank you for sharing.

  13. morrisknuth February 10, 2014 at 1:05 am - Reply

    Thanks a lot! This tutorial really helped :)

Leave A Response »