Home > Operation and Maintenance > CentOS > How to solve garbled characters in apache environment under centos

How to solve garbled characters in apache environment under centos

王林
Release: 2020-03-26 14:57:33
Original
2951 people have browsed it

How to solve garbled characters in apache environment under centos

Problem description:

When using the Apache server to install the GBK-encoded program in the CentOS system, garbled characters appear.

Analysis:

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 be generated.

(Recommended tutorial: centos tutorial)

Solution:

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

# vi /etc/httpd/conf/httpd.conf
Copy after login

2. Find the AddDefaultCharset configuration item

AddDefaultCharset UTF-8
Copy after login

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

AddDefaultCharset Off
Copy after login

4. At the same time, you can also set the default encoding of Apache to GB2312, as follows:

AddDefaultCharset GB2312
Copy after login

Recommended related video tutorials: linux video tutorial

The above is the detailed content of How to solve garbled characters in apache environment under centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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