将Zend从LAMP移动到共享服务器错误

时间:2013-09-06 17:23:16

标签: php zend-framework

Fatal error: Uncaught exception 'UnexpectedValueException' with message 
'DirectoryIterator::__construct(/modules) [<a href='directoryiterator.--construct'>directoryiterator.--construct</a>]: 
failed to open dir: No such file or directory' in 
/home/www/zf/library/Zend/Controller/Front.php:289 Stack trace: 
#0 /home/www/zf/library/Zend/Controller/Front.php(289): DirectoryIterator->__construct('/modules') 
#1 /home/www/zf/library/Zend/Application/Resource/Frontcontroller.php(72): Zend_Controller_Front->addModuleDirectory('/modules') 
#2 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(683): Zend_Application_Resource_Frontcontroller->init() 
#3 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(626): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('frontcontroller') 
#4 /home/www/zf/library/Zend/Application/Bootstrap/BootstrapAbstract.php(586): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL)
#5 /home/www/zf/library/Zend/Application.php(355): Zend_Application_Boot in /home/www/zf/library/Zend/Controller/Front.php on line 292

这是我得到的错误。我检查了所有的路径,看起来都是正确的。我不知道这个错误到底是什么。请帮忙。

这是我的index.php

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/home/www/mf/application'));

//path for public
defined('PUBLIC_PATH')
    || define('PUBLIC_PATH', realpath(dirname(__FILE__) . '/home/www/iops.axeleron.biz'));


// 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 . '/home/www/zf/library'),
    get_include_path(),
)));




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


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

2 个答案:

答案 0 :(得分:0)

您的APPLICATION_PATH看起来不对劲。如果你很高兴硬编码,你可能想要:

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', '/home/www/mf/application'));

同样对下面的PUBLIC_PATH行应用更改。

一般来说,你不想硬编码路径,而你之前可能拥有的是:

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

应该仍然有用。这将使用当前文件的路径来计算应用程序路径。

答案 1 :(得分:0)

谢谢大家的回复。我自己解决了这个问题。我的服务器需要到处都有硬编码路径,所以我在config和index.php中进行了这些更改,它的工作就像一个魅力。

感谢您的帮助!...