无法在 debian 上为 php 安装“intl”扩展

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6727736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:05:14  来源:igfitidea点击:

Can't get to install 'intl' extension for php on debian

phpdebianpeclintl

提问by matubaum

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

我有一个 debian 服务器,我想通过 pecl 安装“intl”扩展。

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:

在安装过程中,它问我:“指定可以在何处找到 ICU 库和头文件 [DEFAULT] :”在这里,我一直在尝试几个选项,包括将其留空以使用 DEFAULT,但出现以下错误:

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

配置:错误:C++ 预处理器“/lib/cpp”未通过完整性检查 请参阅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).

我已经安装了 php5.3:make && make install。我已经安装了“icu”,但与 php5.3 不同的是,它是用 apt-get 安装的(我不知道这是否重要)。

Any idea?

任何的想法?

回答by JMK

On Ubuntu 12.04 LTS, the following worked for me:

在 Ubuntu 12.04 LTS 上,以下对我有用:

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

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

砰,警告消失了!希望这对将来的某人有所帮助:)

回答by szabola

You need to install libicu44 and libicu-dev:

你需要安装 libicu44 和 libicu-dev:

apt-get install libicu44 libicu-dev

and after this you can install intl with pecl:

在此之后,您可以使用 pecl 安装 intl:

./pecl install intl


Note if using Ubuntu:

如果使用 Ubuntu,请注意:

It lLooks like the first package libicu44is not available, in which case just install libicu-devand it will go through the dependencies and handle it for you. Seems to use libicu42at the moment.

看起来第一个包libicu44不可用,在这种情况下只需安装libicu-dev,它将通过依赖项并为您处理。目前好像在用libicu42

回答by Sylvain Artois

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

Debian Squeeze 用户可以使用以下命令安装 intl 扩展:

须藤 apt-get 安装 php5-intl

first comment

第一条评论

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

该软件包甚至适用于我的旧 Ubuntu 8.04 ...

回答by ahmedhelmy007

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

sudo apt-get install g++之前安装 g++sudo ./pecl install intl对我有用。

回答by Darren Cook

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

我知道这听起来很熟悉;我在 2008 年 5 月遇到了同样的问题,这里讨论过: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.

Ed Batutis 解释说,如果您在“/usr/bin/icu-config”中有 icu-config,则“/usr”是正确的答案;如果它在其他地方,请相应地调整。

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.

然而,这对我没有帮助。我在这里为我描述了解决方案:http: //darrendev.blogspot.com/2008/05/install-php-pecl-intl-module-for-ubuntu.html ...这基本上是定义 PHP_SETUP_ICU 宏。这应该是在 5.2.4 中添加的,因此当您使用 php 5.3 时,您的问题应该是其他问题。