Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Tommy001's avatar

Need workaround to run composer.

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?

0 likes
2 replies
Tray2's avatar
Tray2
Best Answer
Level 73

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.

Tommy001's avatar

YOU ARE THE BEST! After creating the php alias I mentioned that worked straight away, by adding the composer command after the line you proposed, like this:

php <path to composer>/composer.phar update
1 like

Please or to participate in this conversation.