One tool I have been playing with recently is Composer which is a dependency manager, think Ruby Gems but for PHP. Which is a great little tool and I’m really happy to see the community getting behind it and moving forward. After just trying to install composer I ran into a little problem which I thought was worth sharing.
After running curl -s https://getcomposer.org/installer | php, I get the following error:
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
Which looks pretty simple to fix but MAMP should have this setting disabled. So I ranwhich php and I’m told I’m running /usr/bin/php which is the version of PHP that comes preinstalled with OS X. So we just need to swap this over to the PHP that is installed with MAMP, which is located at
/Applications/MAMP/bin/php/php5.3.6/bin
/Applications/MAMP/bin/php/php5.3.6/bin
To do this I edit my .bash_profile or .profile if you are using a different shell and add the MAMP version of PHP to the PATH variable.
export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:$PATH
It’s important to append the existing $PATH at the end otherwise the version of PHP in /usr/bin/php will be found and loaded first instead. Save the .bash_profile and reload your profile by typing
source ~/.bash_profile
and run which php, and if you’ve done everything right should say /Applications/MAMP/bin/php/php5.3.6/bin/php.
No comments:
Post a Comment