Working with multiple php versions on CLI / Composer

Working with multiple php versions on CLI / Composer

There are a few reasons why we built our hosting solution around Plesk.

1) It is extremely light weight. Essentially its only function is to provide a front end for configuring nginx / apache / php. That is it.  There are no other over heads.

2) It is extremely flexible. You can specify any version of php or a different apache / nginx config on a per domain basis.

With this latter feature there does come a few issues you need to bear in mind when working on the command line.

At any point in time there is a default php version on the CLI. However, you can call any other version directly at any time using


Where X.X is the php version you require eg


If you are working with composer you may also need to work with a specific version of php.  While you can edit composer.json it is easier to specify when you call composer

/opt/plesk/php/X.X/bin/php /usr/lib/plesk-9.0/composer.phar [options] [arguments]

Again where X.X is the version of php your project requires.

This will allow you to meet dependency need regardless of what the current CLI version of PHP is configured.

© Dx3webs Ltd. All Rights Reserved. | Company No. 08221801 | VAT No GB142 6020 55 | Terms & Conditions | Privacy Policy