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 .我现以罗技摄像头为例 ...
随机推荐
- How to stop uwsgi when no pidfile in config?
原文: how-to-stop-uwsgi-when-no-pidfile-in-config Q: I've just installed uwsgi by pip install uwsgi in ...
- 解决Qt在openSUSE上编译出现“cannot find -lGL”错误
在openSUSE上编译QT5.4程序出现“cannot find -lGL”,就连example都无法通过编译.QT是在官网下的最新的安装包. 大体意思是,缺少qt运行时所需要的openGL库.决绝 ...
- IIS7 配合 vs2013内置 LocalDB使用
错误提示: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误.未找到或无法访问服务器.请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接. (provide ...
- SpringMVC从入门到精通之第四章
第一个知识点:@Controller注解,用于标识这个类是一个后端控制器(类似struts中的action),主要作用就是接受页面的参数,转发页面.中间的业务逻辑是调用业务类处理的这个就是MVC设计模 ...
- 【HTML5】嵌入另一张HTML文档、通过插件嵌入内容、嵌入数字表现形式
1.嵌入另一张HTML文档 iframe 元素允许在现有的HTML文档中嵌入另一张文档.下面代码展示了iframe元素的用法: <!DOCTYPE html> <html lang= ...
- guava 学习笔记 使用瓜娃(guava)的选择和预判断使代码变得简洁
guava 学习笔记 使用瓜娃(guava)的选择和预判断使代码变得简洁 1,本文翻译自 http://eclipsesource.com/blogs/2012/06/06/cleaner-code- ...
- 邮件页面为何只能Table写及注意事项
编写HTML邮件与编写HTML页面有很大的不同.因为,各面向网民的主流邮箱都或多或少的会对它们接收到的HTML邮件在后台进行过滤.毫无疑问,JS代码是被严格过滤掉的,包括所有的事件监听 属性,如onc ...
- Java—Servlet开发
Servlet API中有4个java包: javax.servlet:包含定义Servlet与Servlet容器之间契约的类与接口. javax.servlet.http:包含定义HTTPServl ...
- nginx访问白名单设置以及根据$remote_addr分发
在日常运维工作中,会碰到这样的需求:设置nginx的某个域名访问只对某些ip开放,其他ip的客户端都不能访问.达到这样的目的一般有下面两种设置方法:(1)针对nginx域名配置所启用的端口(一般是80 ...
- http://www.cnblogs.com/figure9/p/developer-reading-list.html
http://www.cnblogs.com/figure9/p/developer-reading-list.html