omic
omic

Reputation: 381

PHP Configure Error: Please specify the install prefix of iconv with --with-iconv=<DIR>

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!!

Upvotes: 23

Views: 16131

Answers (5)

Yarco
Yarco

Reputation: 803

There's another way to do that. In my case, I've already installed PHP through homebrew. And I'm trying to compile PHP from source, then in the step of ./configure, it gives such error.

So, you can check how homebrew does it. find out the path of iconv lib As you can see, if you have MacOSX SDK, you've already had iconv lib installed (so, no need to install another lib through homebrew).

Upvotes: 0

Mark Fox
Mark Fox

Reputation: 8924

With Homebrew:

brew install libiconv

then

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

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

Upvotes: 51

Mehmet G&#246;kalp
Mehmet G&#246;kalp

Reputation: 454

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.

Upvotes: 3

jamix
jamix

Reputation: 5628

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.

Upvotes: 7

codewizard
codewizard

Reputation: 1627

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

Upvotes: 10

Related Questions