Composer running @ Dreamhost

Using composer on a Dreamhost shared server

I’m starting yet another project (but this one I intend to finish, I swear 🙏) and I’m using Symfony to develop it. But when you deploy to Dreamhost, you can’t use composer by default (unless you are the proud owner of a VPS server).

I configured my site to use PHP 7.3 and with that I learned that this is the version for the webserver. When you connect via ssh it uses another version (7.2 in my case). That said, before installing composer, we need to update our PHP CLI version:

Step 1: Updating the CLI version

All you have to do is update your .bash_profile file and update the PATH to the updated version:

vi ~/.bash_profile
export PATH=/usr/local/php73/bin:$PATH

Type :wq to save and exit vi.

Reload you bash using source ~/bash_profile. You can check if it worked by running php -v.

Step 2: Installing composer

Install it globally by creating a .php/composer folder:

mkdir ~/.php/composer
cd ~/.php/composer

And then install composer:

curl -sS | php

Rename it (optional but useful):

mv ~/.php/composer/composer.phar ~/.php/composer/composer

And add it to your bash to make your life easier:

export PATH=/home/your_username/.php/composer:$PATH

Do not forget to reload your bash just like before. 👍

Step 3: Tweaking PHP

Create or update your phprc file at /home/your_username/.php/7.3/phprc:

extension =
suhosin.executor.include.whitelist = phar

extension = is just in case your phar extension is disabled. And pcre.jit is because of some strange error related to symfony console happening on 7.3. It happened to me but may not happen to you 😁

Step 4: Run composer

Now everything is supposed to be ok and you can navigate to your domain folder and run composer:

composer install

Assuming you already uploaded your files or cloned your repository, of course 👀

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.