由“假设不支持utf-8,不支持字符集"充斥的error_log.讯息 [英] error_log flooded by "charset not supported, assuming utf-8" messages

查看:277
本文介绍了由“假设不支持utf-8,不支持字符集"充斥的error_log.讯息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题: WordPress博客的错误日志中充斥着假设utf-8,不支持字符集"消息;在24小时内将0字节增长到450 Mb(如果统计正确,则页面浏览量约为28000).

The issue: Wordpress blog's error log is flooded by "charset not supported, assuming utf-8" messages; grows 0 bytes to 450 Mb in 24 hrs (~28k page views, if stats are correct).

详细信息::我有一个由Wordppress支持的博客,托管在共享托管帐户中.它已经运行了很多年,直到不久前这才成为问题,但是我无法确定何时开始发生的确切时间范围.几个月前,我开始超出允许的资源(主要是内存),因此他们将我转移到其他服务器,并且我不得不升级该帐户以允许更高的资源使用率.旧服务器正在运行php5,这是php7.最新的WP +大约15个流行的插件,全部都是各自的最新版本.主题很古老,从一开始就存在.

Details: I have a Wordppress-powered blog hosted on shared hosting account. It's been running for years, and this was never an issue until not too long ago, but I can't pinpoint the exact time frame when this started to happen. A few months ago I started to exceed my allowed resources (memory mostly), so they moved me to a different server, and I had to upgrade the account for higher allowed recourse usage. Old server was running php5, this one - php7. Latest WP + around 15 popular plugins, all al respective latest versions. The theme is ancient, it's been there from the beginning.

昨天,我删除了网站根目录中9 GB(!)的错误日志,今天24小时后又删除了它的500 MB.所有行都是相似的:

Yesterday I deleted the error log of 9 GB(!) in the site's root, today, 24 hrs later its 500 MB. All lines are similar:

[datetime] PHP Warning:  html_entity_decode(): charset `keep-ali0' not supported, assuming utf-8 in /home/accountname/public_html/wp-includes/formatting.php on line 5124
[datetime] PHP Warning:  htmlentities(): charset `/[^0-9\.]/' not supported, assuming utf-8 in /home/accountname/public_html/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 5
... etc.

我解析了较旧的2 GB日志:

I parsed the older 2 GB log:

  • 它们来自13个文件:3个核心WP文件,其他来自6个不同的插件
  • 仅通过以下功能:htmlentities()htmlspecialchars()html_entity_decode()
  • 1000多个独特的字符集":全部都是垃圾,大多数都包含不可打印的字符,其他仅是奇怪的东西:路径(不是我的!),正则表达式,整数,十六进制值...:#^[a-z]:[/\\]#imeta_value0x7fe858ae2920/home/someone-elses-account-name/public_html/includes/functions.php,...
  • they came from 13 files: 3 core WP files, others from 6 different plugins
  • only from these functions: htmlentities(), htmlspecialchars(), html_entity_decode()
  • over 1000 unique "charsets": all are garbage, most include non-printable chars, others just weird stuff: paths (not mine!), regexes, integers, hex values...: #^[a-z]:[/\\]#i, meta_value, 0x7fe858ae2920, /home/someone-elses-account-name/public_html/includes/functions.php, ...

这些值从何而来?

我什至在哪里可以开始对此进行故障排除?

推荐答案

看来这是PHP中的一个已知错误,很难重现,因此会停留一段时间.

It appears this is a known bug in PHP, which is difficult to reproduce so it's stuck around a while.

https://bugs.php.net/bug.php?id=71876

建议了各种解决方法,包括:

Various workarounds have been suggested, including:

  • 在php.ini中设置internal_encoding=utf-8或使用ini_set('internal_encoding', 'utf-8');
  • 确保在php.ini中未设置default_charset
  • 将字符集添加到函数调用中,例如html_entity_decode($x, null, 'utf-8');
  • Setting internal_encoding=utf-8 in php.ini or using ini_set('internal_encoding', 'utf-8');
  • Ensuring that default_charset is not set in php.ini
  • Adding the character set to the function call, e.g. html_entity_decode($x, null, 'utf-8');

这些变通办法似乎产生了不同的结果.

These workarounds appear to have mixed results.

这篇关于由“假设不支持utf-8,不支持字符集"充斥的error_log.讯息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆