我有一个非常古老的CakePHP 1.3.2应用程序,它曾经在给定域下的服务器上工作。我有原始文件,现在我正在设置它并让它在不同域下的新服务器上运行。
首先,我必须在webroot / index.php中修复以下行:
define('CAKE_CORE_INCLUDE_PATH', '/home/SOME_NAME/cakephp-1.3.2');
因为应用程序甚至找不到框架。它现在确实找到了,但我收到404 Page Not Found
错误。我完全不知道是什么导致它,我甚至无法使用新的user / pass / host参数确定数据库连接是否成功。事情的唯一指示是我在服务器上找到的以下日志文件,每次我尝试通过浏览器访问应用程序时,它都会填充以下行:
2015-06-09 10:00:24 Warning: Warning (512): /home/SOME_NAME/public_html/OLD_DOMAIN_NAME/tmp/cache/ is not writable in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/cache/file.php, line 267]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): array_keys() expects parameter 1 to be array, boolean given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1936]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): array_keys() expects parameter 1 to be array, boolean given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1949]
2015-06-09 10:00:24 Warning: Warning (2): array_filter() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1953]
2015-06-09 10:00:24 Warning: Warning (2): array_values() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1953]
2015-06-09 10:00:24 Warning: Warning (2): array_unique() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 2045]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): array_keys() expects parameter 1 to be array, boolean given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1936]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): array_keys() expects parameter 1 to be array, boolean given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1949]
2015-06-09 10:00:24 Warning: Warning (2): array_filter() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1953]
2015-06-09 10:00:24 Warning: Warning (2): array_values() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1953]
2015-06-09 10:00:24 Warning: Warning (2): array_unique() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 2045]
2015-06-09 10:00:24 Warning: Warning (2): array_unique() expects parameter 1 to be array, null given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1229]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1448]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): array_keys() expects parameter 1 to be array, boolean given in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo_source.php, line 1936]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
2015-06-09 10:00:24 Warning: Warning (2): Invalid argument supplied for foreach() in [/home/SOME_NAME/cakephp-1.3.2/cake/libs/model/datasources/dbo/dbo_mysql.php, line 127]
有关如何从这里开始将错误范围缩小到更具体的建议的任何建议吗?
答案 0 :(得分:1)
您的第一个错误是因为/home/SOME_NAME/public_html/OLD_DOMAIN_NAME/tmp/cache/
不可写。确保tmp
具有正确的文件权限;它需要由Web服务器用户编写。
否则您的问题似乎是数据库配置错误,因此应用无法连接到数据库。检查app/config/database.php
并确保数据库设置正确,并确保bootstrap.php
不会改变连接(可能取决于安装了应用程序的服务器)。
您可以使用以下方法检查代码中使用的数据库设置: -
Configure::read('Session.database');
在你的一个错误附近测试这个。
如果你能解决这两个问题,你应该做得很好。
答案 1 :(得分:0)
你的工作已经完成了。对于初学者,我会创建一个phpinfo来查看旧服务器和新服务器之间的配置差异。
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>