更新到 Zend Framework 2.2.5 后出现自动加载器错误


Autoloader Error after updating to Zend Framework 2.2.5

作为警告,我不是程序员。 我继承了一个使用 Zend 框架的应用程序,需要更新,我正在努力在这里尽力而为。 如果您能提供详细信息来解决问题,我将不胜感激。

将Zend框架更新到2.2.5版本后,我开始收到如下所示的错误。我在网上遇到了这个问题,但我不确定如何使用这些示例来纠正错误。http://framework.zend.com/manual/2.1/en/modules/zend.loader.autoloader-factory.html

Warning: require_once(/Zend/Loader/Autoloader.php): failed to open stream: No such file or   directory in D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs'globals.php on line 38
Fatal error: require_once(): Failed opening required '/Zend/Loader/Autoloader.php'   (include_path='.;D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs/library/;D:'vFabricWS'vfabric- web-server'ProductionApp'htdocs/library/Doctrine/;D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs/library/Braishfield/;D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs/application/;D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs/application/default/models/;D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs/application/default/forms/') in D:'vFabricWS'vfabric-web-server'ProductionApp'htdocs'globals.php on line 38
*

*这是我正在使用的主要全局数据配置文件:

//Define root path
//define('ROOT_PATH', dirname(__FILE__));
//Modify include path to include path to libraries and application folders
ini_set('include_path', '.' . 
    PATH_SEPARATOR . ROOT_PATH . '/library/' . 
    PATH_SEPARATOR . ROOT_PATH . '/library/Doctrine/' .
    PATH_SEPARATOR . ROOT_PATH . '/library/CompanyName/' .
    PATH_SEPARATOR . ROOT_PATH . '/application/'  . 
    PATH_SEPARATOR . ROOT_PATH . '/application/default/models/'  . 
    PATH_SEPARATOR . ROOT_PATH . '/application/default/forms/'
    );
//Include Loader File, and Load needed Classes
//require_once 'Zend/Loader.php';
require_once '/Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);
//Load some config files and store them in the Registry for the rest of the
//app to access
if (! defined( 'UNIT_TESTING' ))
{
   $config = new Zend_Config_Ini(ROOT_PATH . '/config/config.ini', 'application');
}
 else
{
$config = new Zend_Config_Ini(ROOT_PATH . '/config/config.ini', 'application');
}

Zend_Registry::set('config',$config);

//turn error reporting on if the debug flag is set in teh config file
$logger = new Zend_Log();
$writer = new Zend_Log_Writer_Firebug();
$logger->addWriter($writer);
Zend_Registry::set('logger', $logger);
if($config->debug)
{
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$writer->setEnabled(true);
}
 else 
{
  ini_set('display_errors','off');
$writer->setEnabled(false);
}
ini_set('log_errors','on');
ini_set('error_log',ROOT_PATH . DIRECTORY_SEPARATOR . 'logs/phperrors.log');
//Set mssql text sizes
ini_set("mssql.textlimit", "65536");
ini_set("mssql.textsize", "65536");
//set default time zone for the application
date_default_timezone_set('America/New_York');

你的应用程序不使用 Zend Framework 版本 2。它使用版本 1,除了大多数时候使用相同的习语和模块之外,两者完全不兼容,因为版本 2 使用 PHP 命名空间,而版本 1 不使用。

如果你想从 1 升级到 2,这是一个主要的重构任务,如果你不是程序员,可能会超出你的能力水平。

另一件事是:如果您使用的是 2.2 版,请不要查看 2.1 版的文档(在您的链接中提到)。

版本 1 的

最新版本是 1.12.3,但请注意不要通过升级到此版本来破坏应用程序,因为次要版本之间的步骤中有时会引入不兼容的更改。因此,如果您没有可靠的测试套件来检查软件的每个部分,那么更新仍将是一些冒险。