Have you removed the phar extension on the composer file?
If not you should be able to use the same trick and the run php <path to composer>/composer.phar.
I haven't tried but it should be a plausible workaround.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
On my shared hosting it's possible to connect with SSH and install and run composer. I can also run php commands by first saving this alias:
alias php="/usr/local/php72/bin/php"
After that I can use the usual php artisan commands. But now to my question. When I try to run composer update it fails with error messages saying that the CLI php version is 5.6.3. I have asked the support people at my shared hosting, and apparently it's not possible to change the default php version for users, only for sites. So is there a way to run composer programmatically instead, from within the application? Or is there another workaround for this?
Have you removed the phar extension on the composer file?
If not you should be able to use the same trick and the run php <path to composer>/composer.phar.
I haven't tried but it should be a plausible workaround.
Please or to participate in this conversation.