Run Composer with a specific PHP Version
It would be great if the already existing "Applications" view would recognize the PHP version that is used within that application path. That way Composer could check the correct PHP version for dependencies and simplify the general use of Composer.
Since Plesk Obsidian 18.0.44, published May 24th, 2022, Composer uses the PHP version that is configured for the domain instead of system PHP. Customers can now run artisan, composer, and other commands without having to specify the whole path.
To propagate and turn on the feature for all subscriptions, run the plesk bin php_settings --update-all command.
To use the feature in Scheduled Tasks, prepend the cron command with the following:
export PATH="/opt/plesk/phpenv/bin:$PATH"; eval "$(phpenv init -)";To disable the feature and bring back how the console worked before, add the following lines to the panel.ini file:
[php]phpenv = off
Note: The feature works for Plesk PHP handlers only. It does not work for custom PHP handlers and CloudLinux with CageFS.
-- PD