Skip to content
xYnta
Go to websitexynta.com
Search
EN

Can I use Composer on a hosting package?

Updated on

Yes, you can use Composer on Web Hosting, WordPress Hosting and Reseller Hosting: in the terminal, and on WordPress Hosting also with the PHP Composer tool in Plesk. On WordPress Hosting, Composer is not ready as a command in the terminal; there you use PHP Composer, or you install Composer yourself as described below.

Composer in the terminal

Open the terminal of your control panel or make an SSH connection (see Connecting via SSH) and type composer --version. If the terminal shows a version number, Composer is ready on your server and you simply use composer. If you get command not found, install Composer in your own folder:

  1. Download the installer

    Type this command and press Enter:

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  2. Install Composer

    Type this command and press Enter. Composer is placed as composer.phar in your home folder.

    php composer-setup.php --install-dir="$HOME"
  3. Remove the installer

    php -r "unlink('composer-setup.php');"
  4. Use Composer

    Start Composer with php in front of it, and give the folder of your project with -d. In DirectAdmin, for example (in Plesk your website is in ~/httpdocs):

    php ~/composer.phar install -d ~/domains/yourdomain.nl/public_html

PHP Composer in Plesk (WordPress Hosting)

  1. Log in to Plesk

    Log in at https://whs1.srvnl.nl:8443. You can find your server name in How can I find the server name of my hosting package?

  2. Open PHP Composer

    On the Dashboard tab, under Dev Tools, click PHP Composer.

  3. Find your composer.json

    Click Scan. Plesk searches all folders of your package for composer.json files and imports them; this can take a few minutes.

  4. Manage the dependencies

    After the import you can edit the file, choose the desired mode, set environment variables, and install and update the package dependencies.

Related articles