Dreamhost – Installing Composer

Composer is a dependency manager for PHP.

Similar to nodes NPM and Python’s “pip” dependency manager, Composer handles the installation of any third party module included within composer.json.

First check your PHP version by running the following command


// get version
php -v

// should give you the following result or similar

PHP 5.6.36 (cli) (built: Apr 30 2018 20:24:54) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies


cd ~/

vi .bash_profile

// in .bash_profile insert the following
export PATH=/usr/local/php56/bin:$PATH


The phprc file

Find your PHP version and insert the following the following snippet of code.


cd ~/.php

vi 5.6/phprc

// insert into phprc
extension = phar.so
suhosin.executor.include.whitelist = phar

Now you can run the following command:


php composer.phar <command>