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:

https://getcomposer.org/

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:

or

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.