2011-11-27 98 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库目录。

相关问题