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

/opt/plesk/php/X.X/bin/php 

Where X.X is the php version you require eg

/opt/plesk/php/7.3/bin/php 

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.


If you need additional composer versions for different projects let us know and we will install


NOTES

all files in root should be owned by the user:psacln

all files should be chmod 644

all folders should be chmod 755

reset if needed.

find . -type f -exec chmod 644 {} \;

find . -type d -exec chmod 755 {} \;


NEVER 777