How to use Composer in my web space?

Composer can be installed on the web space as follows:

Required

  • Web space user with SSH access enabled
    • SSH access is configured as described here
  • SSH client software to establish connection to the web space, for example:

Configuration

  • Connect via SSH to the web space
  • Run php -r "phpinfo();" to ensure a compatible PHP version is used in the console. If this is the first time php is run in the console, you will get a selection of available PHP versions in the console. You can reset this setting by deleting the ~/.phpcfg file (rm ~/.phpcfg).
  • Run php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");' to get the checksum of the current version of the Composer installer.
  • Run php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" to download the Composer installer.
  • Run php -r "echo hash_file('sha384', 'composer-setup.php');" and compare the displayed checksum with that from the command above. Both values must be identical.
  • Run php composer-setup.php to set up Composer.
  • Composer can now be run via the path displayed in the previous step.

Optional: add composer to console PATH

  • If not already done, create a new .bash_profile file: touch ${HOME}/.bash_profile
  • Add the path from the previous step of the basic installation to the $PATH using the .bash_profile file. Example: echo "export PATH=\$PATH:/home/webq7y5xt/composer.phar" > ${HOME}/.bash_profile.
  • Composer can be called without the absolute path after reloading .bash_profile (composer.phar).

Don't hesitate to subscribe to our newsletter



Thank you for subscribing to the hosting.fr newsletter.
PHP Composer Shell SSH