Articles in this section

How to run Composer with Plesk PHP

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

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

How to run Composer with Plesk PHP?

Answer

 

Run Composer from Plesk interface

In Plesk Obsidian, Composer is available as a Plesk extension. To learn more about PHP Composer Plesk extension, visit:

 

Run Composer from a command-line interface

To use composer with Plesk PHP (e.g. to install additional libraries), connect to a Plesk server via SSH (Linux) / RDP (Windows Server) and use the following commands, where X.X is a PHP version:

Warning: Be careful when installing untrusted packages as root/super user. See https://getcomposer.org/root for details.

  • on CentOS/RHEL-based distributions:

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

  • on Debian/Ubuntu-based distributions:

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

  • on Windows Server:

    C:\> "%plesk_dir%Additional\PleskPHPXX\php.exe" "%plesk_dir%Additional\Composer\composer.phar" [options] [arguments]

 

Additional Information

To add Composer to chrooted environment, visit this KB article.

Was this article helpful?

Comments

2 comments
Date Votes
  • Good morning. thank you for your article
    I have installed the plesk composer extension on the server. OK

    Now how do I run the installation of something?
    For example I want to install phpmailer

    In the command prompt when I type I execute the instruction:

    composer require phpmailer/phpmailer

    'composer' is not recognized as an internal or external command,
    operable program or batch file.

    Could you help with information?

    0
  • Hi Jhoni Rosales

    The article says that to run composer, you need to use one of these commands instead of "composer":

    • on CentOS/RHEL-based distributions:

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

    • on Debian/Ubuntu-based distributions:

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

    where X.X is a PHP version

    1

Please sign in to leave a comment.