Some people have had a hell of a time (including myself at one time) installing Composer on a shared DreamHost account Here’s how did it. I’m going to assume you know what a shell user is and how to use basic terminal (CLI/SSH).
Requirements
- A shared DreamHost account
- Make sure your user is sftp (shell access)
- I suggest updating your domain that your installing composer on to run PHP 5.4.x w/ FastCGI
- Wait 5-10 minutes for everything to move to 5.4 (if your not there already)
Step 1: Running PHP 5.4 (or 5.3) in CLI (Command Line Interface)
- Login via SSH (if you are not logged in already)
- Navigate to ~/ (
$ cd ~/
)
- Create or edit the existing file (
$ nano .bash_profile
)
- On a new line copy and paste this code
export PATH=/usr/local/php54/bin:$PATH
- Save the file and exit (CTRL+O then CTRL+X)
- You may need to logout and log back in
- If you’ve decided to run PHP 5.3 instead of PHP 5.4 change php54 to php53 in the path
Step 2: Enable the Phar Extension
- Login via Putty or whatever flavor you like
- Navigate to ~/ (
$ cd ~/
)
- Create the folder ~/.php (
$ mkdir -p ~/.php/5.4
)
- Create the file ~./.php/5.4/phprc (
$ nano ~/.php/5.4/phprc
)
- Pop these jewels into the file on seperate lines
extension = phar.so
suhosin.executor.include.whitelist = phar
- Save the file and exit (CTRL+O then CTRL+X)
- If you’ve decided to run PHP 5.3 instead of PHP 5.4 change 5.4 to 5.3 in the path
Step 3: Hurray!
- After you’ve completed steps 1 and 2, log out of putty and then log back in, run the command
$ php -v
or of that does not work for you run $ php --version
and it should say that it’s running PHP 5.4 CLI.It should look something like this:
PHP 5.4.11 (cli) (built: Feb 12 2013 19:02:05)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
If not, then you’ve messed up somewhere along the line.
- Now you can run the following command in the directory you want to use Composer in (go to the directory first them run this command)
curl -s https://getcomposer.org/installer | php
- You should see some installation success messages; this is good!
If you see the following error:
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The phar extension is missing.
Install it or recompile php without --disable-phar
This means you’re on a DH server that has a different set of expectations for phrc. To fix it:
$ cd ~/.php
$ mkdir 5.4
$ mv phprc 5.4/phprc
(or, if you’re using PHP 5.3, that would be $ mkdir 5.3
and $ mv phprc 5.3/phprc
)
- If you don’t see any errors, it should have been installed correctly, now try running it > php composer.phar
- By running the command above, you should see a list of green and grey items, you’ve installed composer
- I’ll assume from here on our you can read the composer documentation and usage 🙂
* You can find my initial writeup on my GH at https://github.com/Braunson/dreamhost-composer-install
Posted By
Braunson Yager
Categories
DreamHost, Tech