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%AdditionalPleskPHPXXphp.exe" "%plesk_dir%AdditionalComposercomposer.phar" [options] [arguments]
Additional Information
To add Composer to chrooted environment, visit this KB article.