Top Nav

Using PHP composer.phar With Non-default PHP Install

Composer for PHP is an increasingly popular tool for managing packages within a PHP application.  Here’s a link for more information:

On many of our Plesk servers we have multiple PHP versions install. The default at /usr/bin/php is provided by the Linux distribution and then there are additional version installed at /opt/plesk/php. Plesk lets us easily select the PHP version for each hosted website. But you can run into problems with composer using the wrong PHP version. A typical composer command might be:


To make our alternate PHP version work we need to instead do something like this:

So we override the default PHP by adding our preferred version to the front of the path.

  • mac

    Thank you very much, I found the info useful as I tried to upgrade my CLI php version in a plesk installation. Changing it per webserver was easy but not to the CLI, with this you can easily do it.