移动蛋糕的PHP网站

时间:2018-09-10 12:08:11

标签: php cakephp

我已将旧的Cakephp网站(2011)移到了新的提供程序,并且该网站无法正常运行。.我有类似的错误

Warning: include(Cake/bootstrap.php): failed to open stream: No such file or directory in /home/toussacfuq/www/app/webroot/index.php on line 77

Warning: include(Cake/bootstrap.php): failed to open stream: No such file or directory in /home/toussacfuq/www/app/webroot/index.php on line 77

Warning: include(): Failed opening 'Cake/bootstrap.php' for inclusion (include_path='/home/toussacfuq/www/lib:.:/usr/local/php5.4/lib/php') in /home/toussacfuq/www/app/webroot/index.php on line 77

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 /home/toussacfuq/www/app/webroot/index.php on line 88

你能帮忙吗? 谢谢

1 个答案:

答案 0 :(得分:0)

看起来您有一个包含自定义路径的变量。由于您要移至其他主机,因此请确保该路径仍然相关。

但是我建议的一件事是使用$_SERVER['DOCUMENT_ROOT']而不是硬编码的文件路径。这将始终有效,并且如果您更改主机也没关系。 $_SERVER['DOCUMENT_ROOT']将始终使您成为Web服务器根目录的开始。这比硬编码相同的功能要好得多,因为在硬编码路径的情况下,您会遇到当前面临的问题。

使用文件路径时,我还建议您始终从根目录开始。浏览自己的代码,想知道在哪里时,浏览起来更容易。特别是如果您的目录是/变成一定大小。像../../../之类的东西使仅通过查看目录路径并了解所有内容之间的连接方式就很难遵循目录路径。

使用$_SERVER['DOCUMENT_ROOT']的示例为:

include($_SERVER['DOCUMENT_ROOT'].'/path/to/file');

只要您确定在$_SERVER['DOCUMENT_ROOT']之后定义的任何路径都是正确的,这将一直有效,并且它将为您节省很多麻烦,例如您正面临的问题现在。

相关问题