Write by lyc at 2020-6-16

zabbix4.0 web控制台中文乱码

问题一:替换字符集

Zabbix4.0解决中文乱码

上传字体文件

1
2
3
4
5
6
$ cd ./zabbix/assets/fonts
$ rz simkai.ttf
$ ll ./zabbix/assets/fonts
total 12252
-rw-r--r-- 1 nginx nginx 756072 Dec 20 00:40 DejaVuSans.ttf
-rw-r--r-- 1 root root 11787328 Jun 16 10:25 simkai.ttf

配置字体

1
2
3
$ vim ./zabbix/include/defines.inc.php
// define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
define('ZBX_GRAPH_FONT_NAME', 'simkai'); // font file name
  • 配置完刷新web控制台即可
  • 如果仍然乱码,请检查是否有如下php编译参数

问题二:php编译参数 –enable-gd-jis-conv 引起的乱码

php编译参数 ‘–enable-gd-jis-conv’ 引起乱码

查看php编译参数

重新编译安装php,去掉编译参数 --enable-gd-jis-conv

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$ /usr/local/php/bin/php -i |grep configure
Configure Command => './configure'
'--prefix=/usr/local/php-7.3.14'
'--with-config-file-path=/usr/local/php-7.3.14/etc'
'--enable-fpm'
'--enable-pcntl'
'--with-pear=/usr/local/php-7.3.14/share/php'
'--with-pdo-mysql'
'--with-mysqli'
'--with-iconv-dir=/usr/local'
'--with-zlib'
'--with-bz2'
'--with-curl'
'--with-libxml-dir'
'--with-gd'
'--with-jpeg-dir'
'--with-png-dir'
'--with-zlib-dir'
'--with-freetype-dir'
'--with-openssl'
'--with-gettext'
'--with-snmp'
'--with-mhash'
'--enable-mbstring'
'--enable-gd-jis-conv' # 这个编译参数引起乱码
'--enable-shmop'
'--enable-sockets'
'--enable-zip'
'--enable-ftp'
'--enable-bcmath'
'--enable-soap'
'--enable-calendar'
'--enable-dba'
'--disable-ipv6'
'--enable-opcache'