3

I'm want to start using phpDocumentor and the manual installation keeps throwing an error about me not having set detect_unicode = Off in my php.ini in Terminal.

When I add it to my php.ini it doesn't take and I get the same issue when running the install. Nobody seems to have this problem, and for the life of me I can't figure it out.

https://github.com/phpDocumentor/phpDocumentor2/blob/develop/README.md#installation

What am I missing? (I did restart the MAMP server after the php.ini edit)

Screenshot of the error in terminal...

enter image description here

3
  • What is Your Apache and PHP version?
    – shadyyx
    Commented Jun 28, 2012 at 9:23
  • MAMP 2.0.5, so Apache/2.2.21 & PHP 5.3.6
    – Foxinni
    Commented Jun 28, 2012 at 9:47
  • Did you get this fixed? I'm having exactly the same issue
    – musoNic80
    Commented Jul 3, 2012 at 9:44

6 Answers 6

8

If you have MAMP/MAMP Pro installed then the problem is that the PHP version available to your terminal will most probably be the system version located in:

/private/etc/

I had the same problem but in my case I didn't have a php.ini file in that directory so the best way to resolve it is to just create a symbolic link to the PHP version currently in use in your MAMP/MAMP Pro installation:

php.ini -> /Applications/MAMP/bin/php/php5.3.14/conf/php.ini

That solves the issue. Just change the php version php5.3.14 to whatever version of PHP you've selected to use in MAMP.

As @moderndegree mentions above, you can then optionally make this available to the terminal in the future by editing your path variable in your bash/zsh/etc:

export PATH="/Applications/MAMP/bin/php/php5.3.14/bin:$PATH"
4

You must not be editing the right php.ini if it still is enabled. Run php -i | grep ini to find all the ini files that are loaded.

The relevant lines are those two:

Loaded Configuration File => ...
Additional .ini files parsed => ...
1
  • mine said /etc so I added a php.ini file there and restarted mamp, then it worked! Commented Oct 12, 2012 at 17:32
4

The problem is that you are probably hitting a different php install.

Try the following:

which php

If you get anything other than, /Applications/MAMP/bin/..., you need update your environment to point to MAMP's installation.

To do this, you will need to add the following to .bash_profile (please update the path to match your setup):

export PATH="/Applications/MAMP/bin/php/php5.3.6/bin:$PATH"

Reload .bash_profile with the following command:

source .bash_profile

After you do this, you should be pointing to the correct php installation. Try which php again to confirm. Now run php -i | grep ini to confirm that the correct php.ini file is being loaded. As Seldaek stated, the relevant lines are:

Loaded Configuration File => ...
Additional .ini files parsed => ...
0

As I remember, MAMP uses configuration templates. So you should edit php.ini template. The actual php.ini will be regenerated from the template everytime you restart MAMP.

0

I faced the same problem for composer-php and i add this line manually into php.ini file. Like this:

sudo /private/etc/php.ini

then add this line "detect_unicode = Off"

detect_unicode = Off

then its work and i installed composer. You can see this How to disable "detect_unicode" setting from php.ini? (trying to install Composer)

0

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 

If you are able to change your php.ini file, then add the following to the end of your php.ini:

detect_unicode = Off

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.