Question

While the upgrade process worked fine on my development system, when I attempted to perform the upgrade on the live database I could only get as far as updating composer.

After this was successfully complete I was unable to do anything else as this is the result of trying to run the CLI tool:

$ php ./bin/magento
PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Framework\Console\CommandListInterface in .../vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73
Stack trace:
#0 .../vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#1 .../vendor/magento/framework/Console/Cli.php(140): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...')
#2 .../vendor/magento/framework/Console/Cli.php(112): Magento\Framework\Console\Cli->getApplicationCommands()
#3 .../vendor/symfony/console/Symfony/Component/Console/Application.php(91): Magento\Framework\Console\Cli->getDefaultCommands()
#4 .../vendor/magento/framework/Console/Cli.php(83): Symfony\Component\Console\Application->__construct('Magento CLI', '2.1.0')
#5 /var/www/vho in .../vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73

The only germane differences I can see is that the failure was in production mode on Amazon Linux AMI release 2016.03, whereas the successful upgrade was in developer mode using OS X. There are no permission issues, and it does not matter if I clear down var and pub/static or restart redis.

Originally Amazon Linux AMI was on PHP 7.0.8, but I downgraded to 7.0.7 after the first answer suggested this as a possible issue. Same error.

I am out of ideas as to why the M2 object manager is failing to instantiate this interface. Any thoughts?

Was it helpful?

Solution

This turned out to be due to missing information in app/etc/di.xml. I was excluding this directory from my deployment as it contains env.php and config.php that do not want to be written over. Copying in the up-to-date version of this file solved the issue.

I then had a further issue with this error showing an error "Class Magento\Framework\App\Cache\Type\Webapi does not exist" due to missing a line from env.php as I had upgraded from an earlier version. I had to add the compiled_config' => 1, entry to the following section of env.php:

'cache_types' =>
array (
'config' => 1,
'layout' => 1,
'block_html' => 1,
'collections' => 1,
'reflection' => 1,
'db_ddl' => 1,
'eav' => 1,
'config_integration' => 1,
'config_integration_api' => 1,
'full_page' => 1,
'translate' => 1,
'config_webservice' => 1,
),

OTHER TIPS

Magento 2.1 and PHP 7.0.8 were released the same day.

Thus, they haven't been tested together: https://twitter.com/elena_a_leonova/status/746080577917452288

There are several issues with Magento 2.1 and PHP 7.0.3 to 7.0.5 you can find more details here: Why doesn't Magento 2.1 support PHP 7.0.3 to 7.0.5?

I suggest you try fresh installing Magento 2.1 with PHP 7.0.8 and if an issue is still happening fill out an issue on the GitHub repo.

Another possible issue could be that your PHP CLI version is different than your PHP web server version.

I think about that because the error you're getting is happening at the following line:

$commandList = $objectManager->create(\Magento\Framework\Console\CommandListInterface::class);

And the ::class keyword for class name resolution has only been introduced in PHP 5.5

So you can check your php cli version by calling:

php -v

Also try replacing the faulty line above with the following:

$commandList = $objectManager->create('\Magento\Framework\Console\CommandListInterface');
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top