php: docker-php-ext-install intl fails
Hi Guys,
I have been trying to enable the intl extension and I have been running into troubles as it keeps failing.
I get:
checking for icu-config... no
checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
I fixed this by running: apt-get install libicu-dev
Rerunning the docker-php-ext-install intl then fails again with the following:
Checking whether g++ accepts -g... no
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/usr/src/php/ext/intl':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
Is this a bug? The container doesn’t appear to have the C++ compiler installed. To fix i used: apt-get install g++
Now the extension installs as expected.
I am using php:5.6-apache for reference.
Hope this helps.
Thanks, Rob
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 27
- Comments: 50 (6 by maintainers)
A working example:
@mikemix @docteurklein I can confirm
g++
is not required for meworks fine for me.
+1 for intl available by default.
In case this helps anyone else, @docteurklein’s Dockerfile config didn’t quite work for me (Docker Toolbox 1.12.0 on Windows 10) but it did successfully install intl when I tweaked it a tiny bit:
ok i will paste it here:
if you guys find improvements to this let me know so i can retrogain as well 👍
Symfony recommends Intl, so it’d be quite nice to have intl in default container setup
@mikemix you guess or you’re sure? Pretty sure I put g++ for a reason, I wouldn’t include it for the fun of it 😃
Guys, I really don’t believe one have to install
g++
to install intl. I guesslibicu-dev
is enough.I don’t think it would be a good idea to enable intl be default.
I use docker for development only, so I might see things from a different perspective, but I like having to deal with my dependencies. It allows me to have a good idea of what has to be installed at the production environment. Silently installed dependencies could lead to a missing dependency on production.
I just ran into this issue, i’m just wondering if we shouldn’t just list the available extensions and what dependencies need to be installed to have it compile.
See also https://github.com/mlocati/docker-php-extension-installer for an attempt to create/maintain such a list (no Alpine support currently).
+1 to enable intl by default
Thanks for the response, I would say from an outsiders point of view that the name “docker-php-ext-install” to me at least indicates that the script is installing the extension and any dependencies.
The issue is that unless you know which dependencies are required to install an extension you end up running it several times to find out where it fails and then google the error 😃 .
Im not suggesting that you should add every dependency under the sun to the container, I am just explaining that the current implementation has some confusion to it.
I don’t like describing a problem unless I can suggest something to resolve it although this is a difficult one.
So here are some suggestions:
I am just trying to think of ways of removing barriers for people who want to use the image but then get stuck when they need to install the dependencies.
If I can help at all with the documentation for docker-php-ext-install let me know as I only stumbled upon this by accident reading the other issues.
@Gasgeber FYI, PHP 5 is end of life (https://secure.php.net/supported-versions.php).
Hi,
I am facing ERROR: intl is required though i have tried by commenting the extension=php_intl.dll extension file in php.ini file. I can see php_intl.dll file in ext folder of php.
Please help me to solve the issue.
Thank You:)
Don’t put anything by default. One can install everything easily. The image should be as skinny as possible. Also please don’t create (up/down)vote posts, stick to emoji please.
Installation is really easy:
I’m not sure but after facing the same problem (solved in the same way @robbydooo did) I’ve realized that Symfony Standard Edition (through its
symfony/intl
component) and CakePHP >= 3 both depend onintl
php extension.I’ve found some references to
intl
extension in Zend2 and Wordpress as well. Then considering that some important PHP frameworks/libs require (or at least make use of this extension) this extension it could be interesting make it easier to enable it.What do you think guys?
Adding g++ seems reasonable though, IMO, since it’s needed to compile some of the core modules.
@joelharkes There isn’t any list as such since it would never be complete. @tianon wrote this blog post and explained how he figures out deps in https://github.com/docker-library/php/issues/75#issuecomment-353673374.
I got same error on
php:7.2-apache
(Debian GNU/Linux 9 stretch) Installedlibicu-dev
then I can install intl.For those who care about having the latest icu data available, it’s rather straight forward to compile it in. See an example here: https://github.com/jakzal/docker-symfony-intl/blob/master/7.2/61.1/Dockerfile
I wouldn’t use those images directly, as they’re meant to provide various icu versions for Symfony development. I’d rather replicate similar steps in your own images. You could also test them out by copying the lib and extension from my images (just tweak php and icu versions to your needs, and test it thoroughly):
@nicogommen I’m not able to reproduce: 😕
I’m not sure this is a right place for a help request.
Hi, Is this configuration still working for you? I’m using php:7.1-fpm as my base image and when I follow the installation of intl I get this warning:
/usr/src/php/ext/intl/idn/idn.c: In function ‘php_intl_idn_to’: /usr/src/php/ext/intl/idn/idn.c:229:4: warning: ‘uidna_IDNToASCII_57’ is deprecated [-Wdeprecated-declarations] converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); ^~~~~~~~~~~~~~~~~ In file included from /usr/include/unicode/platform.h:23:0, from /usr/include/unicode/ptypes.h:50, from /usr/include/unicode/umachine.h:44, from /usr/include/unicode/utypes.h:36, from /usr/include/unicode/uidna.h:20, from /usr/src/php/ext/intl/idn/idn.c:28: /usr/include/unicode/uidna.h:673:1: note: declared here uidna_IDNToASCII( const UChar* src, int32_t srcLength, ^ /usr/src/php/ext/intl/idn/idn.c:231:4: warning: ‘uidna_IDNToUnicode_57’ is deprecated [-Wdeprecated-declarations] converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status); ^~~~~~~~~~~~~~~~~ In file included from /usr/include/unicode/platform.h:23:0, from /usr/include/unicode/ptypes.h:50, from /usr/include/unicode/umachine.h:44, from /usr/include/unicode/utypes.h:36, from /usr/include/unicode/uidna.h:20, from /usr/src/php/ext/intl/idn/idn.c:28: /usr/include/unicode/uidna.h:720:1: note: declared here
I tried with zlib1g-dev libicu-dev g++ as @Tocacar suggested and also the simple install by @mikemix. Both generate this warning.
Intl should not be installed by default. also if some frameworks like Cake or Symfony (that I’m using and that is the reason why I landed on this issue) require it, it is not a mandatory package.
For example, with Symfony, if you develop a CLI app, there are 99% of possibilities you don’t need the Intl extension.
And also if you develop a web app, the Intl extension is only required by validators:
So, my point is to provide clear and definitive examples of how to install the Intl ext, but not including it by default as it is not always required.
My 2 cents.
i just wanted a solution for alpine not force any intl onto the core.
I resolved it.
Well, at least this thread is one of the top results when you google the error message. Thanks guys.
Even if it’s not included by default, it would be cool if we provide an example of a way to install it (docment an example Dockerfile or something).