My server currently is using PHP 7.1 but I need to run PHP 7.4 during my drush commands on one of my sites. The following works for almost all commands:
/path/to/my/php74 ../vendor/bin/drush cr
/path/to/my/php74 ../vendor/bin/drush cim -y
But when I run the update database command I get an error:
/path/to/my/php74 ../vendor/bin/drush updb -y
or:
export DRUSH_PHP=/path/to/my/php74 && /path/to/my/php74 ../vendor/bin/drush updb -y
I get the following error:
In Process.php line 266:
The command "/home/releases/74/vendor/drush/drush/drush updatedb:status --yes --no-entity-updates --strict=0 --uri=default --root=/ho
me/releases/74/web" failed.
Exit Code: 255(Unknown error)
Working directory:
Output:
================
Warning: Unsupported declare 'strict_types' in /home/releases/74/vendor/phpstan/phpstan/bootstrap.php on line 1
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/releases/74/vendor/phpstan/phpstan/bootstrap.php on line 12
Error Output:
================
I'm guessing during the updb command it calls another command but it doesn't retain my php version.