Skip to main content

Resources - changing Drush

Type Version
Drush (current) 11.6.0
Drush (update) 12.2.0

Updating Drush went OK on all testing environments until on to the staging environment. 

The initial error that I saw was

PHP Fatal error:  Declaration of Drush\Style\DrushStyle::confirm($question, $default = true) must be compatible with Symfony\Component\Console\Style\SymfonyStyle::confirm(string $question, bool $default = true): bool in /var/www/html/{project}/vendor/drush/drush/src/Style/DrushStyle.php on line 11

Followed by attempting to run composer update

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - drush/drush[12.0.0, ..., 12.2.0] require composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.
    - Root composer.json requires drush/drush ^12 -> satisfiable by drush/drush[12.0.0, ..., 12.2.0].

To resolve this problem, update your composer by running the following command:

composer self-update

 

Comparing the Composer versions

Environment Version
Local 2.5.2 2023-02-04 14:33:22
Ubuntu server 2.1.5 2021-07-23 10:35:47

Ubuntu server Composer version post running the self-update command

2.6.2 2023-09-03 14:09:15

 

Related articles

Andrew Fletcher03 Apr 2024
Using Drush to run SQL commands
To run a SQL command using Drush, use the following sql-query commanddrush sql-query "COMMAND"As an example, in the following I will remove all of the records in the Watchdog. Delete from watchdogTo empty (clear) the watchdog table, which contains Drupal's log messages, using the above noted...
Andrew Fletcher12 Mar 2024
Drush open_basedir restriction error
Drush open_basedir restriction errorPHP Warning: include(): open_basedir restriction in effect. File(/usr/share/drush/includes/startup.inc) is not within the allowed path(s): (/var/www/vhosts/{domain}/:/tmp/) in /usr/share/drush/drush on line 113 PHP Warning: ...