问题
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." http://uk3.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
回答1:
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.
回答2:
compiled php from source seems to be the way
php -m > /tmp/php.modules
to list of compiled module for php
backup 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)
来源:https://stackoverflow.com/questions/4156983/php-iconv-glibc-to-libiconv-on-centos-5-5