Home > Backend Development > PHP Tutorial > Problem with garbled web pages when installing GBK encoding program in Apache environment under CentOS system_PHP tutorial

Problem with garbled web pages when installing GBK encoding program in Apache environment under CentOS system_PHP tutorial

WBOY
Release: 2016-07-13 10:55:27
Original
1086 people have browsed it

Problem description In the CentOS system, GBK-encoded programs installed using the Apache server appear to have garbled characters. This is mainly because the character encoding of the Apache server installed by default is UTF-8. If there is no forced encoding in the GBK program, garbled characters will appear.

Solution
1. Open the Apache configuration file httpd.conf, such as /etc/httpd/conf/httpd.conf

by default

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

2, find the AddDefaultCharset configuration item

AddDefaultCharset UTF-8

3. Modify the AddDefaultCharset configuration and turn off the configuration characters, as follows

AddDefaultCharset Off

4, you can also set the default encoding of Apache to GB2312 as follows

AddDefaultCharset GB2312

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632245.htmlTechArticleProblem Description: In the CentOS system, the GBK encoded program installed using the Apache server appears garbled. This is mainly because the default installation The Apache server character encoding is UTF-8, if there is no...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template