Problem:
A lamp server running on line, PHP does not support iconv functions.
Workaround:
Install LIBICONV, recompile Apache, enable PHP to support Iconv functions, implement UTF-8 and gb2312 encoded conversions.
Specific steps:
1, download Libiconv
Cd/usr/local/src
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz #下载
2. Installation Libiconv
Cd/usr/local/src
Tar zxvf libiconv-1.14.tar.gz #解压
CD libiconv-1.14 #进入安装目录
./configure--prefix=/usr/local/libiconv #配置
Make #编译
Make install #安装
3, recompile PHP
Find the PHP compilation parameters before the system
Cd/usr/local/php/bin #进入php安装目录
./php-i |more #查看php编译参数
As follows:
'--with-pdo_sqlite=shared '--enable-bcmath=shared '--enable-ftp=shared '--enable-mbstring=shared '--with-iconv =shared '--enable-sockets=shared '--enable-zip '--enable-soap=s
Hared '--with-openssl ', '--with-zlib ', '--with-curl=shared '--with-gd=shared '--with-jpeg-dir ', '--with-png-dir ' With-freetype-dir '--with-mcrypt=shared '--with-mhash=shared '--with-mysql=/ho
Me/server/mysql '--with-mysqli=/home/server/mysql/bin/mysql_config '--with-pdo-mysql=/home/server/mysql/bin/ Mysql_config '--without-pear ' '--with-libdir=lib64 '
To modify a parameter:
As follows
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-apxs2=/usr/local/apache/bin /apxs--with-gettext=shared--with-sqlite=shared--with-pdo_sqlite=shared--enable-bcmath=shared--enable-ftp= Shared--enable-mbstring=shared--with-iconv-dir=/usr/local/libiconv--enable-sockets=shared--enable-zip-- enable-soap=shared--with-openssl--with-zlib--with-curl=shared--with-gd=shared--with-jpeg-dir-- With-freetype-dir--with-mcrypt=shared--with-mhash=shared--with-mysql=/home/server/mysql--with-mysqli=/home/ Server/mysql/bin/mysql_config--with-pdo-mysql=/home/server/mysql/bin/mysql_config--without-pear--with-libdir= Lib64
Remarks: Modify part
Cancel the original--with-iconv=shared
To be replaced by:--with-iconv-dir=/usr/local/libiconv
Remove single quotes on both sides of a parameter
Other unchanged
cd/usr/local/src/php #进入php安装包目录 (Note that PHP version should be the same as before)
./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-apxs2=/usr/local/apache/bin /apxs--with-gettext=shared--with-sqlite=shared--with-pdo_sqlite=shared--enable-bcmath=shared--enable-ftp= Shared--enable-mbstring=shared--with-iconv-dir=/usr/local/libiconv--enable-sockets=shared--enable-zip-- enable-soap=shared--with-openssl--with-zlib--with-curl=shared--with-gd=shared--with-jpeg-dir-- With-freetype-dir--with-mcrypt=shared--with-mhash=shared--with-mysql=/home/server/mysql--with-mysqli=/home/ Server/mysql/bin/mysql_config--with-pdo-mysql=/home/server/mysql/bin/mysql_config--without-pear--with-libdir= Lib64 #配置
Make #编译
Make install #安装
4, restart Apache to make the settings effective
Service httpd Restart #重启
Fault Resolution!