Reputation: 8035
I've been trying to install Composer on my machine (OS X 10.6) with no success so far.
As per Composer docs, i executed this in Terminal:
curl -s http://getcomposer.org/installer | php#!/usr/bin/env php
And this is the output:
The detect_unicode setting must be disabled. Add the following to the end of your
php.ini
: detect_unicode = Off
Of course, this is in my php.ini: detect_unicode = Off, located at /etc/php.ini.default
php -info tells me that php.ini file is being loaded from /etc/ (output is: Configuration File (php.ini) Path => /etc)
But, also outputs: detect_unicode => On => On
Why php.ini.default is not loading my settings and how could i disable effecively detect_unicode?
Upvotes: 29
Views: 18576
Reputation: 3075
If you can't change your /usr/local/bin/php/php.ini file, remember to keep using '-d detect_unicode=Off' for all your php calls like so:
curl -s https://getcomposer.org/installer | php -d detect_unicode=Off
php -d detect_unicode=Off composer.phar install
Upvotes: 2
Reputation: 34
There are a few solutions online, but the easiest I found was on Stack Overflow. The problem is that the PHP CLI doesn’t load the same php.ini by default, and unlike on most Linux installations there isn’t a seperate php-cli.ini and seemingly /etc/php.ini.default doesn’t load so much. You can pass it as a runtime parameter though:
curl -s getcomposer.org/installer | php -d detect_unicode=Off
source -> http://www.andrew-kirkpatrick.com/2012/10/install-composer-for-php-on-zend-server-mac-os-x/
Upvotes: 0
Reputation: 1674
Just add "-d detect_unicode=Off" after the command
curl -s https://getcomposer.org/installer | php -d detect_unicode=Off
Upvotes: 59
Reputation: 181
Under OSX go to /etc
.
Open Terminal.
>cd /etc
>nano php.ini.default
Edit the php.ini.default
(insert detect_unicode = Off
).
Save the file.
Now rename it to php.ini
.
>mv /etc/php.ini.default /etc/php.ini
Restart Terminal and then it should work proberly.
Upvotes: 18
Reputation: 42036
Most likely no ini file at all is being loaded, I don't know if /etc/php.ini.default is seen or not by php. Same as I said in Can't set/find detect_unicode to Off - you should run php -i | grep ini
and check which file actually is loaded, then edit it. If none is loaded, then make sure you put a php.ini file into the Configuration File Path
value, in your case /etc/php.ini
it seems.
Upvotes: 22