Andrei Petrov
Andrei Petrov

Reputation: 11

CakePHP install on local pc (xampp) incorrect paths

I have script built with an old version of CakePHP.The script works just fine on live servers but when i tried to install it on my pc (with XAMPP installed) igot problems...I have this error:

Warning: include(cake\bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\hack\index.php on line 76

Warning: include(): Failed opening 'cake\bootstrap.php' for inclusion (include_path='\C:\xampp\htdocs\hack\cakecore;\C:\xampp\htdocs\hack\cakeapp\;.;C:\xampp\php\PEAR') in C:\xampp\htdocs\hack\index.php on line 76

Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your \cake core directory and your \vendors root directory. in C:\xampp\htdocs\hack\index.php on line 77

I'm pretty sure that this error is triggered by incorrect paths in index.php file,because if i made wrong path in index on the live website got exactly the same erorr.The problem is that i have no idea how to fix that paths.

My site files are located in: C:\xampp\htdocs\mysite

So here is how i made the paths on index.php file:

/**
 * The full path to the directory which holds "app", WITHOUT a trailing DS.
 *
 */
if (!defined('ROOT')) {
    define('ROOT', DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite');
}
 /**
 * The actual directory name for the "app".
 *
 */
if (!defined('APP_DIR')) {
    define('APP_DIR', 'cakeapp');
}
/**
 * The absolute path to the "cake" directory, WITHOUT a trailing DS.
 *
 */
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore');
}

Can you tell me what I missing?I have spent 2 days on this and can't find a solution.

Upvotes: 1

Views: 4421

Answers (1)

user221931
user221931

Reputation: 1852

You're defining CAKE_CORE_INCLUDE_PATH as DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore' which in windows will translate to a wrong path of \C:\xampp\htdocs\mysite\cakecore. Notice it starts with \ when it should be C:\....

So make it 'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore' or 'C:\xampp\htdocs\mysite\cakecore' as there isn't any advantagle in using DS if you place C: in the path, it will work only in windows after all.

Upvotes: 1

Related Questions