2011-11-27 30 views
1

我有一個網站... imaspy.com ...我無法使用我上傳到我的主機帳戶的Zend Framework。在我的共享主機帳戶上使用Zend-Framework時遇到問題

請到我的網站並嘗試成爲註冊用戶(您可以使用假信息)並查看我收到的錯誤。這裏是錯誤:

Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/92/5336292/html/imaspy/scripts/library.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:mikerader.com/ZendFramework/library') in /home/content/92/5336292/html/imaspy/scripts/library.php on line 5

這是我用於library.php的代碼。 (不是真正的密碼)

// Adjust the path to match the location of the library folder on your system 
$library = 'mikerader.com/ZendFramework/library/'; 
set_include_path(get_include_path() . PATH_SEPARATOR . $library); 
require_once('Zend/Loader/Autoloader.php'); 
try { 
    Zend_Loader_Autoloader::getInstance(); 
    $write = array('host'  => 'imaspy.db.5336292.hostedresource.com', 
        'username' => 'imaspy', 
        'password' => 'password123', 
        'dbname' => 'imaspy'); 
    $read = array('host'  => 'imaspy.db.5336292.hostedresource.com', 
        'username' => 'imaspy', 
        'password' => 'password123', 
        'dbname' => 'imaspy'); 

    // Comment out the next two lines if using mysqli 
    // and remove the comments from the last two lines 
    $dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write); 
    $dbRead = new Zend_Db_Adapter_Pdo_Mysql($read); 

    //$dbWrite = new Zend_Db_Adapter_Mysqli($write); 
    //$dbRead = new Zend_Db_Adapter_Mysqli($read); 
} catch (Exception $e) { 
    echo $e->getMessage(); 
} 

回答

3

這裏是你的錯誤:

$library = 'mikerader.com/ZendFramework/library/'; 

您需要使用服務器不是一個URL上的路徑。喜歡的東西:

$library = $_SERVER['DOCUMENT_ROOT'] . '/path/to/zend/library'; 

或者,只要你有正確的權限,絕對路徑將工作太:

// or wherever it is 
$library = '/home/content/92/5336292/html/imaspy/library/Zend'; 

另外,爲什麼你要爲這樣的2個分貝適配器對象時,他們」重新都一樣嗎?

+0

這對於班級來說是件愚蠢的事。我只是編輯它,使其生活。我要測試你的解決方案,馬上回來。 –

+0

噢,我明白了。他們實際上在你的學校教Zend Framework嗎?請記住,我使用的路徑是假設的,請確保您仔細檢查並使用正確的路徑。 –

+0

是的,我的工作很完美......謝謝!是的,我們正在使用的這本書正在教導如何使用Zend Framework在網站上設置用戶帳戶。 –

0
在php.ini

的include_path =您的本地路徑到你的Zend庫目錄。

你可能沒有訪問php.ini文件, 但是你可以嘗試通過你的.htaccess文件做:

php_value include_path中的本地路徑到你的Zend庫目錄。