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

4

23

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

Dendroid answered 28/7, 2014 at 1:18 Comment(0)
D
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
Diaster answered 28/7, 2014 at 1:57 Comment(7)
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 errorDendroid
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.Diaster
You can also get more info by running "./configure --enable-debug"Diaster
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.Dendroid
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.Dendroid
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 productionDiaster
@Diaster --enable-debug produces no extra output for mePeddle
E
49

With Homebrew:

brew install libiconv

then

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

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

Enrapture answered 2/11, 2015 at 1:11 Comment(0)
D
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
Diaster answered 28/7, 2014 at 1:57 Comment(7)
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 errorDendroid
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.Diaster
You can also get more info by running "./configure --enable-debug"Diaster
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.Dendroid
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.Dendroid
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 productionDiaster
@Diaster --enable-debug produces no extra output for mePeddle
M
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.

Misguided answered 21/3, 2015 at 10:14 Comment(3)
+1 PHP is looking for the directory containing the executable not the executable itself. This worked for me.Bewilder
This worked for me - not sure why --with-iconv=/opt/local/bin/ didn't workTurret
I spoke too soon. make failed, and it looks like it was something to do with iconv.Turret
A
3

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.
Assembly answered 30/11, 2019 at 10:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.