Articles in this section

How to upgrade PHP composer on a Plesk server

kb: how-to Plesk for Linux ABT: Group B

Applicable to:

  • Plesk for Linux

Question

How to upgrade PHP composer on a Plesk server?

Answer

Instructions for CentOS/RHEL/CloudLinux
  1. Connect to the server via SSH

  2. Check what version is currently used:

    Note: replace X.X with the current PHP version and <Version> with the desired composer version.

    # /opt/plesk/php/X.X/bin/php /usr/lib64/plesk-9.0/composer.phar --version

  3. Update or downgrade to the specified version:

    # /opt/plesk/php/X.X/bin/php /usr/lib64/plesk-9.0/composer.phar self-update <Version>

    Note: In case the command above does not work, use the below one:
    /opt/plesk/php/X.X/bin/php /usr/local/psa/var/modules/composer/composer.phar selfupdate --2

For example:

# /opt/plesk/php/7.3/bin/php /usr/lib64/plesk-9.0/composer.phar self-update 2.0.8
Upgrading to version 2.0.8 (stable channel).

Instructions for Debian/Ubuntu
  1. Connect to the server via SSH

  2. Check what version is currently used:

    Note: replace X.X with the current PHP version and <Version> with the desired composer version.

    # /opt/plesk/php/X.X/bin/php /usr/lib/plesk-9.0/composer.phar --version

  3. Update or downgrade to the specified version:

    # /opt/plesk/php/X.X/bin/php /usr/lib/plesk-9.0/composer.phar self-update <Version>

    Note: In case the command above does not work, use the below one:
    /opt/plesk/php/X.X/bin/php /usr/local/psa/var/modules/composer/composer.phar selfupdate --2

For example:

# /opt/plesk/php/7.3/bin/php /usr/lib/plesk-9.0/composer.phar self-update 2.0.8
Upgrading to version 2.0.8 (stable channel).

Was this article helpful?

Comments

2 comments
Date Votes
  • I place the comand as yoour examples and get "No such file or directory"

    0
  • Following the Ubuntu instructions works as intended. However after a while Composer is downgraded back to 1.x, probably because of Plesk auto updates.

    0

Please sign in to leave a comment.