2015-06-09 94 views
1

我有一個非常古老的CakePHP 1.3.2應用程序,用於在給定域下的服務器上工作。我有原始文件,現在我試圖設置它,並讓它在不同域下的新服務器上運行。將CakePHP 1.3.2應用程序移動到新服務器

起初,我不得不修覆在根目錄/ index.php文件以下行:

define('CAKE_CORE_INCLUDE_PATH', '/home/SOME_NAME/cakephp-1.3.2'); 

的應用程序甚至找不到框架。它現在找到它,但我得到404 Page Not Found錯誤。我完全無能爲力,並且我甚至無法確定數據庫連接是否成功使用新的用戶/密碼/主機參數。一些事情的唯一跡象是,我的服務器上找到以下日誌文​​件,並獲取與以下行每次我試圖通過瀏覽器來訪問應用程序時填充:

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

您是否嘗試過搜索「OLD_DOMAIN_NAME」的應用文件?它會出現在你的代碼中某處的引用,你需要改變它。 – drmonkeyninja

+0

新服務器上的文件仍位於OLD_DOMAIN_NAME文件夾中,因此路徑存在且文件仍在此處。我會搜索一下,看看還有什麼會彈出。 – mmvsbg

回答

1

你的第一個錯誤是因爲/home/SOME_NAME/public_html/OLD_DOMAIN_NAME/tmp/cache/不寫。確保tmp具有正確的文件權限;它需要由Web服務器用戶寫入。

否則你的問題似乎是數據庫配置是錯誤的,所以應用程序無法連接到數據庫。檢查app/config/database.php並確保數據庫設置正確,並確保bootstrap.php未更改連接(可能取決於安裝該應用程序的服務器)。

您可以檢查使用您的代碼正在使用的數據庫設置: -

Configure::read('Session.database'); 

測試你的錯誤,這附近的一個。

如果你能清除這兩個問題,你應該很好。

+0

第一個現在被清除了,謝謝。至於數據庫問題,它似乎是安裝正確的,我沒有看到任何可能會改變連接的bootstrap.php。任何想法如何驗證它是否按預期工作? – mmvsbg

+0

嗯,可能無關緊要,但我在webroot/index中有以下兩行。php: $ Dispatcher = new Dispatcher(); $ Dispatcher->調度(); 我得到的錯誤是在調用dispatch()之後生成的。 – mmvsbg

+0

'Dispatcher'代碼沒問題,因爲它來自Cake本身(https://github.com/cakephp/cakephp/blob/1.3/app/webroot/index.php)。我已經更新了我的答案,並提供了一個關於檢查哪些數據庫設置正在使用的建議。仍然懷疑這是你問題的原因。 – drmonkeyninja

0

你有你的工作剪裁你。對於初學者,我會創建一個phpinfo來查看舊服務器和新服務器之間的配置差異。

<?php 

// Show all information, defaults to INFO_ALL 
phpinfo(); 

// Show just the module information. 
// phpinfo(8) yields identical results. 
phpinfo(INFO_MODULES); 

?> 

phpinfo

+0

我無法訪問舊服務器。這個網站在一年多以前就一直在這裏上演,現在它已經走了。 – mmvsbg

+0

我強烈建議您在本地或非生產環境中開發網站。我仍然會在當前服務器上運行phpinfo。我還會在php.ini文件中更改/添加以下設置:ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); –

+0

另外,你有沒有在當前主機上配置cakewalk?你目前的主機是否支持使用cakewalk? –

相關問題