20

I'm trying to configure PHP 5.5 on MAMP, following this post:

Having problems while try to install OAUTH with PECL in MAMP on mac OS lion.

After I move the downloaded PHP folders into MAMP/bin/php (I also tried to create a directory of /php5.5.14/include/php as described in the post above) and ran ./configure.

I got an error:

checking for iconv support... yes
checking for iconv... no
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=< DIR >

Where can I "specify the install prefix" or how can I solve this problem?

Thanks!!

Community
  • 1
  • 1
omic
  • 351
  • 1
  • 2
  • 7

4 Answers4

42

With Homebrew:

brew install libiconv

then

./configure --with-iconv=$(brew --prefix libiconv)

brew --prefix libiconv normally evaluates to /usr/local/opt/libiconv

Mark Fox
  • 8,694
  • 9
  • 53
  • 75
10

Do exactly as the error says in your console. It's looking for iconv but it can't find it.

./configure --with-iconv=pathToIconv

I guess we should probably check to see if iconv is installed by running "iconv --help" if it's not installed you can install it with homebrew, or you could add the existing files to your PATH variable. I am not sure how mamp works in this scenario.. PHP should use iconv if it is installed on the machine. Due to the way mamp contains itself it may be full filling this dependency in a weird way. As I understand it best practice is to have iconv built into the php installation so you should put the effort into tracking down the path.To my understanding you can install it without iconv and as long as the dependency is being fulfilled it will run as expected.

./configure --without-iconv
codewizard
  • 1,029
  • 1
  • 13
  • 22
  • Thanks! How can I find the 'pathToIconv'? I found a directory '/Applications/MAMP/bin/php/php5.5.14/include/php/ext/iconv/' so I put ./configure --with-iconv=/Applications/MAMP/bin/php/php5.5.14/include/php/ext/, but it still shows the same error – omic Jul 28 '14 at 02:47
  • I'm updating my answer. If '/Applications/MAMP/bin/php/php5.5.14/include/php/ext/iconv/' is a directory you will probably want to go into that directory. You can also try running "find -iname *iconv*" and that will spit out a list of files that have iconv in their name. Im on linux and mine is installed in usr/bin... I don't quite remember OSX's file structure it's likely to be in usr but I don't know how mamp handles that whole scenario. – codewizard Jul 28 '14 at 03:15
  • 1
    You can also get more info by running "./configure --enable-debug" – codewizard Jul 28 '14 at 03:50
  • 2
    Thanks CodeWizard. iconv is confirmed installed by running "iconv --help" as you suggested. Yeah, I tried the path into iconv but got the same error. In OSX iconv is also contained in /usr/bin/ as a single file. I guess the path '/Applications/MAMP/bin/php/php5.5.14/include/php/ext/iconv/' is for iconv installation ? (since it includes files like 'config.m4', 'iconv.c' and header files). I tried both /usr/bin/ and the installation path above in --with-iconv but no good luck. – omic Jul 29 '14 at 12:40
  • 2
    But the command "./configure --withouth-iconv" works for me: configuration can be completed in this case and oauth installation by pecl also works afterwards! I'm good for now and I'll update this post if any new progress with iconv. – omic Jul 29 '14 at 12:46
  • That's great I'm glad it's working. Mamp or you local machine is probably fulfilling this dependency. It would be great for anyone that stumbles on the this post if you were to test some iconv functionality to see if it is properly running. I would highly suggest choosing an alternative local development environment such as vagrant, which relies on a virtual machine but creates a better containment of your environment. Its best to ensure your configuration isn't relying on your local system or mamp to ensure smoother transitions into production – codewizard Jul 31 '14 at 05:19
  • @codewizard --enable-debug produces no extra output for me – Jon McClung Oct 05 '18 at 17:06
7

I had iconv installed with MacPorts so the executable was located at /opt/local/bin/iconv. Specifying ./configure --with-iconv=/opt/local did the trick.

jamix
  • 5,484
  • 5
  • 26
  • 35
2

I am using phpbrew to install iconv extension into php.

When i tried to install iconv with /usr/local/Cellar/libiconv/1.16

phpbrew ext install iconv -- --with-iconv=/usr/local/Cellar/libiconv/1.16

It returned error:

checking if awk is broken... no
checking for iconv support... yes, shared
checking for iconv... no
checking for libiconv... no
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>

It solved using brew's iconv:

brew install homebrew/core/libiconv
phpbrew ext install iconv -- --with-iconv=$(brew --prefix libiconv)

Result:

===> Enabling extension iconv
[*] iconv extension is enabled.
Done.
Mehmet Gökalp
  • 314
  • 3
  • 6