CentOS 5.5 上的 PHP ICONV glibc 到 libiconv
我在使用 PHP 函数 iconv 时遇到了一些问题,我已经追踪到了 iconv 的实现。正如手册所述,“请注意,某些系统上的 iconv 函数可能无法按您的预期工作。在这种情况下,最好安装 GNU libiconv 库。” https://www.php.net/manual/en/intro.iconv。 php
我已经从 http://www.gnu.org/ 下载了 libiconv 库software/libiconv/ 并使用以下命令安装它,没有任何问题:
$ ./configure --prefix=/usr/local
$ make
$ make install
我现在的问题是如何将此安装链接到 PHP?根据我读到的内容,我需要重新编译 PHP
--with-iconv-dir=/usr/local/
但我该如何在 CentOS 上做到这一点呢?我安装了 php
yum install php.x86_64
我尝试yum重新安装php,但是当我服务httpd重新启动时,我的phpinfo读取相同的glibc。
有没有更好的方法在 CentOS 上安装 libiconv?如果不是,我怎样才能使用这个安装来获取 PHP 而不扰乱 yum?
预先非常感谢
I'm having a few issues with the PHP function iconv, which I've tracked down the the iconv implementation. As the manual states, "Note that the iconv function on some systems may not work as you expect. In such case, it'd be a good idea to install the GNU libiconv library." https://www.php.net/manual/en/intro.iconv.php
I've downloaded the libiconv library from http://www.gnu.org/software/libiconv/ and installed it without any problems using:
$ ./configure --prefix=/usr/local
$ make
$ make install
My problem now is how to link this installation to PHP? From what i've read I need to recompile PHP with
--with-iconv-dir=/usr/local/
but how do I do this on CentOS? I installed php with
yum install php.x86_64
I tried yum reinstall php but when I service httpd restart my phpinfo reads the same, glibc.
Is there a better way to install libiconv on CentOS? If not how do I get PHP using this installation without upsetting yum?
Many thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从源代码编译 php 似乎是
php -m > 的方式/tmp/php.modules 到 php 的已编译模块列表
备份当前的 php.ini
yum uninstall php
下载 php
并基于您现有的模块+ iconv - 几乎所有步骤都已在此处详细说明: http://www.php.net/manual/en/install.unix.apache2.php#90478(除非永远不建议你备份 php.ini)
compiled php from source seems to be the way
php -m > /tmp/php.modules
to list of compiled module for phpbackup your current php.ini
yum uninstall php
download the php
and base on your existing module + iconv - almost all steps has been detailed here : http://www.php.net/manual/en/install.unix.apache2.php#90478 (except never advise u to backup php.ini)
在手动更改配置脚本后,您应该手动重新编译 php iconv 扩展(在
php-xyz/ext/iconv/
子目录中),以强制它选择 GNU libiconv 而不是 glibc 的 iconv。请参阅我的 类似堆栈问题的答案。You should manually recompile the php iconv extension (in the
php-x.y.z/ext/iconv/
subdirectory) after manual changing of the configure script to force it to select GNU libiconv instead of glibc's iconv. See my answer for the similar Stack question.