Linux下安装libiconv使php支持iconv函数
问题:
线上运行的lamp服务器,php不支持iconv函数。
解决方法:
安装libiconv,重新编译apache,使php支持iconv函数,实现utf-8和gb2312编码的转换。
具体步骤:
1、下载libiconv
cd /usr/local/src
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz #下载
2、安装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、重新编译php
查找系统之前的php编译参数
cd /usr/local/php/bin #进入php安装目录
./php -i |more #查看php编译参数
如下:
'--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'
对参数进行修改:
如下
./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-png-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
备注:修改部分
取消原来的--with-iconv=shared
替换为:--with-iconv-dir=/usr/local/libiconv
取消参数两边的单引号
其它不变
cd /usr/local/src/php #进入php安装包目录(注意php版本要和之前一样)
./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-png-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、重启apache使设置生效
service httpd restart #重启
故障解决!
Linux下安装libiconv使php支持iconv函数的更多相关文章
- Linux下安装PHP的GD支持库
Linux下安装PHP的GD支持库 1.安装 zlib wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz ...
- centos6.4下安装freetds使php支持mssql
centos版本:6.4 php版本5.3.17 没有安装之前的情况:nginx+php+mysql+FPM-FCGI 接下来安装步骤如下: 1.打开http://www.freetds.org/,进 ...
- linux下安装或升级GCC4.8.2,以支持C++11标准[转]
在编译kenlm的时候需要安装gcc, 然后还需要安装g++. g++安装命令:sudo apt-get install g++ ----------------------以下为网上转载内容,加上自 ...
- Linux下安装php环境并且配置Nginx支持php-fpm模块[www]
Linux下安装php环境并且配置Nginx支持php-fpm模块 http://www.cnblogs.com/freeweb/p/5425554.html 5分钟搭建 nginx +php --- ...
- Linux下安装Apache并以mod_wsgi方式部署django站点
源码编译方式安装Apache 首先下载Apache源码压缩包,地址为http://mirror.bit.edu.cn/apache/httpd/ 继续下载apr和apr-util压缩包,地址为http ...
- (转载)Linux下安装配置MySQL+Apache+PHP+WordPress的详细笔记
Linux下安装配置MySQL+Apache+PHP+WordPress的详细笔记 Linux下配LMAP环境,花了我好几天的时间.之前没有配置过,网上的安装资料比较混乱,加上我用的版本问题,安装过程 ...
- Nginx入门篇-基础知识与linux下安装操作
我们要深刻理解学习NG的原理与安装方法,要切合实际结合业务需求,应用场景进行灵活使用. 一.Nginx知识简述Nginx是一个高性能的HTTP服务器和反向代理服务器,也是一个 IMAP/POP3/SM ...
- Ubuntu Linux下安装Oracle JDK
from://http://blog.csdn.net/gobitan/article/details/24322561 Ubuntu Linux下安装Oracle JDK Dennis Hu 201 ...
- RedHat Linux 下安装、测试摄像头
RedHat Linux 下安装.测试摄像头(全文见附件) 随着视频电话的迅速发展我相信大家一定有过在Windows 下安装摄像头的经历,然而大多数 都不支持Linux .我现以罗技摄像头为例 ...
随机推荐
- android:context,getApplicationContext()生命周期
getApplicationContext() 返回应用的上下文,生命周期是整个应用,应用摧毁它才摧毁Activity.this的context 返回当前activity的上下文,属于activity ...
- Spring AOP 开发中遇到问题:Caused by: java.lang.IllegalArgumentException: warning no match for this type name: com.xxx.collector.service.impl.XxxServiceImpl [Xlint:invalidAbsoluteTypeName]
在网上找了很多,都不是我想要的,后来发现是我在springaop注解的时候 写错了类名导致的这个问题 @Pointcut("execution(* com.xxx.collector.ser ...
- Debian Environment Variables
原文:EnvironmentVariables General Environment variables are named strings available to all application ...
- Linux 下从头再走 GTK+-3.0 (三)
之前我们为窗口添加了一个按钮,接下来让这个按钮丰富一点.并给窗口加上图标. 首先创建 example3,c 的源文件. #include <gtk/gtk.h> static void a ...
- nodemanager execute container fail many times
ttempt_1448915696877_13139_m_000141_0 100.00 FAILED map > map px42pub:8042 logs Wed, 09 Dec 2015 ...
- Team Foundation Server 15 功能初探
1. 系统安装 1.1. 系统需求 新版的TFS的系统要求发生了很大的变化,主要包含: - 不再支持32位的操作系统,只支持64位操作系统 - 只支持SQL 2014和SQL Server 2016, ...
- [转]Using Entity Framework (EF) Code-First Migrations in nopCommerce for Fast Customizations
本文转自:https://www.pronopcommerce.com/using-entity-framework-ef-code-first-migrations-in-nopcommerce-f ...
- 翻译《Writing Idiomatic Python》(三):变量、字符串、列表
原书参考:http://www.jeffknupp.com/blog/2012/10/04/writing-idiomatic-python/ 上一篇:翻译<Writing Idiomatic ...
- Sass关于颜色函数的乐趣
阅读目录 1. 了解RGB和HSL颜色标准 2. RGB函数 3. HSL函数 4. Opacity函数 5. 其他颜色函数 6. 一个简单的应用 在Sass中,定义了很多现成的函数,可供我们使用.在 ...
- sqlmap小白操作
转载地儿:http://blog.csdn.net/zgyulongfei/article/details/41017493 对于网络安全人员来说,掌握渗透工具的使用方法是一项必备的技能.然而,一个没 ...