ZF2 skeleton application is throwing 500 error

2019-02-18 15:08发布

问题:

When trying to deploy the skeleton application using the following commands:

git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install

I get the following error:

PHP Fatal error: Uncaught exception 'Zend\\ServiceManager\\Exception\\InvalidArgumentException' with message 'Provided abstract factory must be the class name of an abstract factory or an instance of an AbstractFactoryInterface.' in /home/web/www/zftests/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:302\nStack trace:\n#0 /home/web/www/zftests/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/Config.php(126): Zend\\ServiceManager\\ServiceManager->addAbstractFactory('Zend\\Cache\\Serv...')\n#1 /home/web/www/zftests/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ModuleManager/Listener/ServiceListener.php(223): Zend\\ServiceManager\\Config->configureServiceManager(Object(Zend\\ServiceManager\\ServiceManager))\n#2 [internal function]: Zend\\ModuleManager\\Listener\\ServiceListener->onLoadModulesPost(Object(Zend\\ModuleManager\\ModuleEvent))\n#3 /home/web/www/zftests/ZendSkeletonApplication/vendor/zendframework/zendframework/library in /home/web/www/zftests/ZendSkeletonApplication/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 302

回答1:

This worked just fine. The problem is that there are two files missing from the ZF2.5 Framework.

  'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
  'Zend\Log\LoggerAbstractServiceFactory',

Thanks, Gary



回答2:

Please comment the following lines found in module/Application/config/module.config.php

      'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
      'Zend\Log\LoggerAbstractServiceFactory',

The skeleton app will work.

Thanks



回答3:

Thanks alot everybody! Looks like the solution for now is to clone the 2.1 tag, as @weierophinney mentioned here: https://github.com/zendframework/ZendSkeletonApplication/commit/80884b7da866f5136654c83604c1270a3228b7b9

git clone -b "zf/release-2.1.0" https://github.com/zendframework/ZendSkeletonApplication.git ./
php composer.phar self-update
php composer.phar install