CakePHP Shared core for multiple apps

前端 未结 5 1893
我寻月下人不归
我寻月下人不归 2020-12-10 08:45

On my local setup I have a load of different CakePHP websites. I\'m using a Mac so the folder structure is something like ~/Users/cameron/Sites/sample-website a

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 09:37

    You are right on the money with:

    define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
    

    Just make sure that Users sits in root. In other words, when you go to terminal you can get to this directory by typing: cd /Users/cameron/Sites/cake-1.3

    It looks like you may be on a MAC. If so, your linking is correct. Most of the time what I find is you have done a copy paste of the app directory and it does not get the .htaccess files. I would check those first. But here is a comprehensive list of what you should verify:

    1. Make sure the host is pointing to the correct directory (/Users/cameron/Sites/sample-site/)
    2. Verify mod_rewrite is in fact on.
    3. Verify you have copied the .htaccess file in both the /Users/cameron/Sites/sample-site/ and the /Users/cameron/Sites/sample-site/webroot directories.
    4. Confirm that the /Users/cameron/Sites/cake-1.3/ directory has a directory called cake in it that contains the core.

    Once all of this is confirmed, you will be good as gold!

    Happy Coding!

    UPDATE: When the index.php file looks for the cake core, it will look for a directory inside the location you are pointing to for another directory called cake. So in your case:

    define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
    

    You must have the cake directory inside /Users/cameron/Sites/cake-1.3. Your directory structure will look like:

    /Users/cameron/Sites/cake-1.3/cake
    /Users/cameron/Sites/cake-1.3/cake/libs
    /Users/cameron/Sites/cake-1.3/cake/config
    /Users/cameron/Sites/cake-1.3/cake/console
    etc.
    

    CakePHP 3.0+ In CakePHP 3.0+ this configuration is moved out of webroot/index.php to App/Config/paths.php

提交回复
热议问题