Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Enable root index.php to get CAKE_CORE_INCLUDE_PATH from PHP 'include_path' #788

wants to merge 2 commits into


None yet
4 participants

Before this path, it was necessary to manually configure the CAKE_CORE_INCLUDE_PATH on the '/index.php' for a shared location Core Lib.

The modification was based on the detection code of the 'webroot/index.php'

@markstory markstory commented on an outdated diff Aug 24, 2012

@@ -36,7 +36,12 @@
* Full path to the directory containing "cake". Do not add trailing directory separator
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+ if (function_exists('ini_set')) {
+ ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+ }
+ else {

markstory Aug 24, 2012


This else is all wrong, try running this change through the code sniffer.

Sorry for the initial mistake.
Corrected version added to this pull.

Ps: The phpcs returned no warnings on the old pull. (Maybe missconfiguration on my part...)


markstory commented Aug 24, 2012

You need to include --standard=CakePHP and install the CakePHP code sniffer rules.

I had done it...
Is the new commit ok?

adael commented Aug 24, 2012

For include path, I think is better to use set_include_path and get_include_path available from (PHP 4 >= 4.3.0, PHP 5)

set_include_path(get_include_path() . PATH_SEPARATOR . $path);


If so, there is a need to change the implementation on files "/app/webroot/index.php" and "/app/webroot/test.php" too.

So, do you want me to implement as @adael said or the commit as it stands is enough?


markstory commented Aug 30, 2012

I don't think there is a need to change the files in webroot, as if you're hitting the top level index.php then CAKE_CORE_INCLUDE_PATH will already be set.


markstory commented Aug 30, 2012

One thing that does need to be updated though is the top level index.php file in lib/Cake/Console/Templates/skel


jippi commented Jul 15, 2013


I'm gonna close this PR as it's 11 months old and haven't gotten any love

Thanks for the contribution though :)

@jippi jippi closed this Jul 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment