2013-01-08 80 views
0

我不習慣Zend Framework,我將我的服務器更改爲godaddy主機,也更改了域名namme。上傳文件後,我在www.abc.com上得到這個錯誤,而在其他主機上工作正常。Zend Godaddy服務器錯誤

我的根目錄下的樣子:

application 
htdocs 
library 
-Zend 

請幫我這個錯誤:

Warning: require_once(Zend/Application.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/37/10289737/html/index.php on line 17 
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Application.php' (include_path=':.:/usr/local/php5_3/lib/php') in /home/content/37/10289737/html/index.php on line 17 

我的index.php文件看起來像這樣

<?php 
// Define path to application directory 
defined('APPLICATION_PATH') 
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); 

// Define application environment 
defined('APPLICATION_ENV') 
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?    getenv('APPLICATION_ENV') : 'production')); 

    // Ensure library/ is on include_path 
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'), 
get_include_path(), 
))); 

/** Zend_Application */ 
require_once 'Zend/Application.php'; 

// Create application, bootstrap, and run 
$application = new Zend_Application(
APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application.ini' 
    ); 

    $options = $application->getOptions(); 
     $db = Zend_Db::factory($options['resources']['db']['adapter'], array(
'host' => $options['resources']['db']['params']['host'], 
'username' => $options['resources']['db']['params']['username'], 
'password' => $options['resources']['db']['params']['password'], 
    'dbname' => $options['resources']['db']['params']['dbname'] 
    )); 

//$db=Zend_Db_Table::getDefaultAdapter(); 

$db->beginTransaction(); 
    $sql = file_get_contents(APPLICATION_PATH . '/data/data.sql'); 
$db->query($sql); 
$db->commit(); 

$application->bootstrap() 
    ->run(); 

而且我無法找到php.ini文件。

+1

是否有'library/Zend/Application.php'文件? –

+0

是thr是一個文件 – user1959600

回答

0

您正在嘗試的路徑添加到您的include_path:

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'), 
    get_include_path(), 
))); 

看,這是從你的錯誤信息:

include_path=':.:/usr/local/php5_3/lib/php' 

所以下面的代碼是不工作

realpath(APPLICATION_PATH . '/../library') 

你的index.php文件在哪裏?在htdocs目錄中? 也許godaddy不允許php腳本訪問htdocs下的文件?

+0

之前,它是在htdocs,然後它沒有采取它, – user1959600

+0

所以我已經移動index.php文件在根文件夾,我需要移動所有文件從htdocs – user1959600

+0

請嘗試var_dump (真實路徑(目錄名(_____ FILE_____)));在index.php開始並在此處發佈結果。我會盡力幫你解決它) –