Home

1 minute read

OS X and Composer Error 'PHP.ini does not exist'

Tony Lea

OS X and Composer Error 'PHP.ini does not exist'

So, I finally decided to move away from using MAMP, which is great; however, I am having to do a lot of troubleshooting. After getting my MAMP stack all setup I was adding all my Laravel projects and going to get all the latest vendor resources via Composer. Unfortunately I ran into the following output up trying to install composer:

$ curl -sS https://getcomposer.org/installer | 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.

The reason for this could be that you have just activated PHP in your OSX Apache configuration, but you still have not renamed the default php.ini file which is located in /etc/php.ini.default, so we can easily do that with a single command and add the detect_unicode = Off at the same time:

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

note: make sure you are logged in as root or you can add sudo in front of the above cp command

Hope this helps someone out. And I'm pretty sure that moving away from using MAMP, I'm going to learn so much more.