我试图让这个cakephp项目在我的本地主机上运行,但总是收到几个错误消息
我收到此错误消息:
警告:include(Cake\bootstrap.php)[function.include]:无法打开流:第77行C:\wamp\www\cts\app\webroot\index.php中没有这样的文件或目录
警告:include()[function.include]:无法打开"Cake\bootstrap.php"以在第77行的C:\wamp\www\cts\app\webroot\index.php中包含(include_path='C:\wamp\www\cts\lib;.;C:\php\pear')
致命错误:找不到CakePHP核心。在APP/webroot/index.php中检查CAKE_CORE_INCLUDE_PATH的值。它应该指向包含您的\CAKE核心目录和您的\vendors根目录的目录。在第86行的C:\wamp\www\cts\app\webroot\index.php中
结束
代码 *Index.php文件:
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
/**line 77**/
if (!include('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
} else {
if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
}
if (!empty($failed)) {
/**line 86**/
trigger_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 " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}
文件结尾
检查index.php的第59行,您会看到类似的内容
//define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
取消注释该行,如果它不起作用,则硬编码lib/文件夹的完整路径,该路径包含一个Cake文件夹和所有CakePHP库。
如果要将CakePHP项目从一个目录复制到另一个目录,请确保复制所有必需的目录。
在将我的项目从旧目录复制到新目录时,我错误地忽略了CakePHP的/lib
目录,认为它包含不必要的git或日志文件。
我错了,通过/lib
目录复制到新的项目目录解决了我的致命错误。