Home >php教程 >php手册 >CentOS系统下Apache环境安装GBK编码程序网页乱码问题

CentOS系统下Apache环境安装GBK编码程序网页乱码问题

WBOY
WBOYOriginal
2016-06-13 09:55:50830browse

问题描述 在CentOS系统中采用Apache服务器安装GBK编码的程序出现乱码,这主要是因为默认安装的Apache服务器字符编码为UTF-8,如果GBK程序中没有强制编码将产生乱码。

解决方法
1,打开Apache配置文件httpd.conf,如默认情况下为 /etc/httpd/conf/httpd.conf

# vi /etc/httpd/conf/httpd.conf

2,找到AddDefaultCharset配置项

AddDefaultCharset UTF-8

3,修改AddDefaultCharset配置,关闭配置字符,如下

AddDefaultCharset Off 

4,同时也可设置Apache默认编码为GB2312如下

AddDefaultCharset   GB2312

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn