is a dependency tool for PHP, a little like the gems for ruby or npm for node.js.

Now when I first try to run it on my mac with the command:

curl -s | php

Fixing the php.ini error

I ran in to 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 detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
    detect_unicode = Off

A php.ini file does not exist. You will have to create one.

Now the only thing I had to do was to copy the file /etc/php.ini.default to /etc/php.ini and to append the line

detect_unicode = Off

You can do that with one line in your Terminal like this, after doing a quick sudo -s for admin rights:

cp /etc/php.ini.default /etc/php.ini && echo "detect_unicode = Off" >> /etc/php.ini

Alias `php composer.phar` to `composer`

Making it all a little nicer, I’ve also added two lines to my .bash_profile file, so I can write composer instead of php composer.phar:

alias getcomposer="curl -s | php"
alias composer="php composer.phar"

This works on my current setup, which is Mac OS X 10.7.5.

You can take a look at my config files over at my github repository: dotfiles.


Join the Conversation

1 Comment

Leave a comment

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