Installing Composer on a Dreamhost VPS, or perhaps other VPS's

By: ( +David Herron; Date: January 12, 2018

Tags: PHP

Modern PHP software development has been modernized by Composer. My exposure to Composer is because the Drupal team adopted the Symfony framework, which in turn is based on Composer. Installing Drupal any longer seemingly requires to first install Composer. Which isn't installed by default on Dreamhost VPS's, but it's not too hard to get it going.

Fortunately it's a lot simpler than it was the first time I tried this a couple years ago.

Because Dreamhost VPS's don't allow root access, you must install Composer and its dependencies in your home directory. The sticking point I had a couple years ago was to install the PHAR extension.

Installing PHAR

The first thing is to verify whether PHAR is installed:

$ php -m | grep Phar

If you get this output, then skip this next step.

SKIPPABLE STEP: The corresponding Dreamhost Wiki page says to create a PHPRC file, /home/USERNAME/.php/VERSION/phprc, and add these lines:

extension = 
suhosin.executor.include.whitelist = phar

On my VPS I found the PHPRC file to already exist and to already contain those lines.

Once you add those lines to your PHPRC, the above command should work. END SKIPPABLE STEP

Switching PHP version for command-line use

Another thing you may wish to do is to change the default PHP version used at the shell command line. What you do is enable this PATH variable change:

export PATH=/usr/local/VERSION/bin:$PATH 

On Dreamhost VPS's, they have multiple PHP versions installed as so:

$ ls -d /usr/local/php*
/usr/local/php53  /usr/local/php54  /usr/local/php55  /usr/local/php56	/usr/local/php70  /usr/local/php71

So, pick your poison. And after switching the PHP version, make sure the PHAR extension is enabled for that version.

Installing Composer

Now that the dependency has been squared away we can install Composer.

There are two modes to consider :- 1) an installation local to a given project, 2) a global installation.

For a local installation:

$ cd ~/<path-to-your-project>
$ curl -sS | php
$ mv composer.phar composer
$ ./composer

The last command should produce a long bit of USAGE output. What this does is download the Componser installer, and run it using PHP. That creates composer.phar in your current directory. For convenience you can rename that file to just composer, and because the PHAR extension is installed you can simply run the PHAR archive.

A global installation is extremely similar but that you'll add a directory to the PATH variable.

For example I keep ${HOME}/bin in my PATH variable on my VPS and install scripts there. The Dreamhost Wiki says to install it in ~/.php/composer, however. The process is the same:

$ cd ~/bin
$ curl -sS | php
$ mv composer.phar composer
$ ./composer

What will be different is to follow this up with adding a line to your ~/.bashrc:

export PATH=/home/<username>/.php/composer:$PATH

In this case it is for installation in ~/.bin/composer, and if you've done as written above you would use ${HOME}/bin in the PATH variable instead.

Once the PATH variable is set up correctly:

$ composer

Should work


Source: (

Source: (

Source: (

« Google possibly dooms YouTube by explicitly cancelling monetization for channels with low viewership These github alternatives give you powerful git hosting, on your own terms »
2016 Election Acer C720 Ad block AkashaCMS Amazon Amazon Kindle America Amiga Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Astronomy Asynchronous Programming Authoritarianism Automated Social Posting Ayo.JS Bells Law Big Brother Big Finish Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnet Botnets Cassette Tapes Cellphones Christopher Eccleston Chrome Chrome Apps Chromebook Chromebooks Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Clinton Cluster Computing Command Line Tools Comment Systems Computer Hardware Computer Repair Computers Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Daleks Darth Vader Data backup Data Storage Database Database Backup Databases David Tenant DDoS Botnet Detect Adblocker Developers Editors Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers Election Hacks Electric Bicycles Electric Vehicles Electron Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Facebook Fake News Fedora VirtualBox File transfer without iTunes FireFly Fraud Freedom of Speech Gallifrey git GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Heat Loss Hibernate Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS Devices iPad iPhone iPhone hacking Iron Man Iternet of Things iTunes Java JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kindle Kindle Marketplace Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac OS Mac OS X Machine Readable ID macOS MacOS X setup Make Money Online MariaDB Mars Matt Lucas MEADS Anti-Missile Mercurial Michele Gomez Micro Apartments Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Node Web Development Node.js Node.js Database Node.js Testing Node.JS Web Development Node.x North Korea npm NY Times Online advertising Online Community Online Fraud Online Journalism Online Video Open Media Vault Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenVPN Paywalls Personal Flight Peter Capaldi Photography PHP Plex Plex Media Server Political Protest Postal Service Power Control Privacy Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero Recycling Refurbished Computers Remote Desktop Republicans Retro Computing Retro-Technology Reviews Right to Repair River Song Robotics Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking SCADA Scheme Science Fiction Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Shell Scripts Silence Simsimi Skype Social Media Social Media Warfare Social Networks Software Development Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Swagger Synchronizing Files Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Ubuntu Udemy UDOO Virtual Private Networks VirtualBox VLC VNC VOIP Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Website Advertising Weeping Angels WhatsApp Window Insulation Windows Windows Alternatives Wordpress World Wide Web YouTube YouTube Monetization