Loading...


Related Products


Date Published: September 29, 2023

PHP version mismatch with Drush

Issue

When attempting to run drush command in your code base and encounter the following error.
$ drush status
Unable to load class Drush\Sql\Sql                                                                                                                                 [error]
Error: Call to undefined method Symfony\Component\HttpFoundation\Response::create() in Drush\Boot\DrupalBoot8->terminate() (line 214 of /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/DrupalBoot8.php).
Drush command terminated abnormally due to an unrecoverable error.                                                                                                 [error]

Resolution

There is a compatibility version mismatch between drush and PHP that needs to be corrected. 
To resolve this issue you need to install the correct version of drush with the PHP version you are on ex. if on PHP 8.x you must install drush 11.x via composer in your code base. 
composer require drush/drush --update-with-all-dependencies

To verify your PHP version run the following command
$ php -v
PHP 8.1.12 (cli) (built: Nov 17 2022 08:00:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation