How to add Composer to a chrooted environment in Plesk?




  • Avatar

    To add composer to a chrooted shell.

    Follow the download instructions from

    While logged in as root

    • sudo su root
    • cd /var/www/vhosts/chroot
    • php -r "copy('', 'composer-setup.php');"
    • If you wish to verify composer is valid, copy the "if (hash_file('SHA384'" line from the website above
    • php composer-setup.php
    • php -r "unlink('composer-setup.php');"

    Now you'll may noticed that when you access the a user that is chrooted, composer is still missing.
    There are a few
    extra commands to update the bin directories of the chrooted user/domain.

    • /usr/local/psa/admin/sbin/chrootmng --remove --source=/var/www/vhosts/chroot --target=/var/www/vhosts/<domain name>
    • /usr/local/psa/admin/sbin/chrootmng --create --source=/var/www/vhosts/chroot --target=/var/www/vhosts/<domain name>

    It's worth noting that if you have a bunch of chrooted users, you may want to write a script to execute the commands all in one go so it will save you a head-ache.

    Good luck.


    Comment actions Permalink
  • Avatar
    Alexandr Redikultsev

    Hello, @Adam!


    Thank you very much for sharing, I am sure this information will come in handy for anyone else who would like to add a composer without using

    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request