In Zone webhosting I have several apps under one account. WordPress websites use PHP 7.4 (as WP does not support php 8). But my Laravel apps use PHP 8.
I can choose php version for server. For example:
laravel-app.mydomain.com – this uses php 8.0
wordpress.mydomain.com – this uses php 7.4
If I need to use command line interface (cli) then php version is always the same that I have set for my main domain settings. If I need to use specific PHP version in cli then I need PHPRC prefix before command of export PHPRC in the beginning of the bash script.
#!/bin/bash
export PHPRC=/etc/opt/zone/php80-cgi
php80-cli -v