Nemesis First solution: https://docs.serv00.com/PHP/#changing-php-settings-for-php-cli
A second solution is to execute composer directly by the desired PHP version, e.g.
$ php82 /usr/local/bin/composer -V
Composer version 2.7.6 2024-05-04 23:03:15
PHP version 8.2.20 (/usr/local/devil/php82/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.
$ php83 /usr/local/bin/composer -V
Composer version 2.7.6 2024-05-04 23:03:15
PHP version 8.3.8 (/usr/local/devil/php83/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.