I have a DigitalOcean server with RunCloud on it, using PHP 7.4 as the default PHP version. As you might know, RunCloud can run applications using different PHP versions but the
php command will always use the default version.
Since Capistrano always uses the default
composer commands you’ll need to do some minor tweaks in order to deploy a new PHP 8 website.
This is the command for running a specific PHP version on RunCloud:
Then, to run Composer using that version you’ll need to run this:
/RunCloud/Packages/php80rc/bin/php /usr/sbin/composer install
To make Capistrano run the Composer like this simply add this to your
SSHKit.config.command_map[:composer] = "/RunCloud/Packages/php80rc/bin/php /usr/sbin/composer"
Finally, because the Symfony plugin also executes some PHP commands such as
bin/console cache:warmup the php command should also be replaced:
SSHKit.config.command_map[:php] = "/RunCloud/Packages/php80rc/bin/php"
That’s all there is to it!