Can't get to install 'intl' extension

2019-03-09 19:37发布

问题:

I have a debian server and I want to install the "intl" extension through pecl.

During the installation it asks me: "Specify where ICU libraries and headers can be found [DEFAULT] :" Here I've been trying several options, including leaving it empty to use DEFAULT, but I get the following error:

configure: error: C++ preprocessor "/lib/cpp" fails sanity check See config.log' for more details. ERROR:/tmp/pear/temp/intl/configure --with-icu-dir=DEFAULT' failed

I've installed php5.3 with: make && make install. I have already installed "icu", but unlike php5.3, it was installed with apt-get (i don't know if this is important).

Any idea?

回答1:

On Ubuntu 12.04 LTS, the following worked for me:

sudo apt-get install php5-intl
sudo /etc/init.d/apache2 restart

Bam, warning gone! Hope this helps somebody in the future :)



回答2:

You need to install libicu44 and libicu-dev:

apt-get install libicu44 libicu-dev

and after this you can install intl with pecl:

./pecl install intl

Note if using Ubuntu:

It lLooks like the first package libicu44 is not available, in which case just install libicu-dev and it will go through the dependencies and handle it for you. Seems to use libicu42 at the moment.



回答3:

Same error:

/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'

But when reading the intl native extension comments, I saw:

Debian Squeeze users can install the intl extension with:

sudo apt-get install php5-intl

first comment

The package works even with my old Ubuntu 8.04...



回答4:

Installing g++ sudo apt-get install g++ before sudo ./pecl install intl did the trick for me.



回答5:

I knew this sounded familiar; I had the same problem back in May 2008, discussed here: http://old.nabble.com/ubuntu-7.10-pecl-install-intl-p17140873.html

Ed Batutis explained that "/usr" is the correct answer if you have icu-config at "/usr/bin/icu-config"; adjust accordingly if it is somewhere else.

However that didn't help for me. I described the solution for me here: http://darrendev.blogspot.com/2008/05/install-php-pecl-intl-module-for-ubuntu.html ...which was basically to define the PHP_SETUP_ICU macro. That was supposed to be added in 5.2.4, so as you are using php 5.3 your problem ought to be something else.