Class “Configure” not found with development setup

Published on and tagged with apache  cakephp  configuration

Usually I use a production or an advanced setup when setting up a CakePHP project, even on my development machine. To verify an issue with NoseRub I had to use a development setup. As I tried to access the application via http://localhost/noserub I got the following error:

Fatal error: Class 'Configure' not found in /var/www/noserub/app/config/core.php on line 43

At first I wondered what I did wrong. Then I realized I forgot to set “AllowOverride All” in the Apache configuration file (/etc/apache2/sites-available/default). So I had to add the following snippet to the aforementioned file and restart Apache to make it work:

<Directory /var/www/noserub/>
    AllowOverride All
</Directory>

Maybe this will help someone else who encounters the same error…

8 comments baked

  • Zonium

    Any time you run into problem with running your application the first time, here are few things you should look at:

    1- Make sure the index.php in the webroot of app points to correct location of cake core
    define(‘CAKE_CORE_INCLUDE_PATH’, ‘/your-path-to/cakePHP’);

    2-(Assuming you are using .htaccess for rewriteRules then: )
    Make sure .htaccess files exist in app folder and in app/webroot

    3-Make sure you allow .htaccess for the app
    Check if you have enabled it, by doing like this

    AllowOverride All

    4- Make sure you restart apache if you have not done so after changing conf file

    5- Make sure tmp folder exists in app

    6- Make sure tmp is own by apache ( or at least read/write-able by the web server )
    You will see a message similar to this if tmp is inaccessible:
    Warning: fopen(app/tmp/logs/error.log) [function.fopen]: failed to open stream: Permission denied in cakePHP/cake/libs/file.php on line 120

    7- Make sure tmp folder does not include obsolete files.
    – Sometimes you change the table structure (add/delete fields) or insert new data into database by hand (e.g via phpMyAdmin), cake will not update the models’s cache and you’ll run into problem.

    – cake uses the class.paths.php in the cache to load files so if tmp is a result of its being copied from somewhere else, class.paths.php will contain paths which are not appropriate for your current application

    You can try to empty tmp.

    Zonium

  • cakebaker

    @Zonium: Thanks for this list!

  • defunkxp

    just a little fix m8,

    AllowOverride All

  • defunkxp

    w00t didn’t paste my entire comment, just add a ‘/’ to Directory closing tag, e.g: —>

  • cakebaker

    @defunkxp: Good eye, it’s now fixed in the article. Thanks!

  • Mark

    I activated module in appache and set (all of the) AllowOverride to All but I still just get the “Fatal Error: class “Configure” not found in..”. I am using xampp and should work on a large cake-php app.

    Do you have any ideas what I might be doing wrong?

  • Mark

    I activated rewrite_module in appache and set (all of the) AllowOverride to All but I still just get the “Fatal Error: class “Configure” not found in..”. I am using xampp and should work on a large cake-php app.

    Do you have any ideas what I might be doing wrong?

  • cakebaker

    @Mark: Hm, did you check whether you set “AllowOverride All” for the correct directory? Another idea is to set the CAKE_CORE_INCLUDE_PATH constant in app/webroot/index.php. Not sure whether this will help as I’m groping in the dark…

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License