技术帝的平台展示,网站建设、网站推广、SEO技术、网站优化、电子商务推广、平面美工和软件测试等技术干货分享。

XAMPP开启Xdebug后无法运行,提示Warning: Header may not contain NUL bytes in

程序技术 abel-lan 176℃ 0评论

摘要

XAMPP v3.2.3开启Xdebug后,断点调试系统无法运行,网页不显示任何内容,查看error.log,提示警告信息PHP Warning: Header may not contain NUL bytes in。最终在xdebug官方网站bug信息中找到该问题,提示原因为v2.7.0RC2版本bug,升级到v2.7.0版本就解决了该问题。

系统环境配置

运行环境XAMPP v3.2.3
PHP版本v.7.3.4
Xdebug版本v2.7.0RC2
开发环境PHPStorm v10.0.2

问题描述

XAMPP运行环境配置Xdebug,在php.ini加入Xdebug配置代码,重启Apache。
Xdebug配置代码如下:

[XDebug]
zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = "req"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.idekey = "PHPSTORM"

PHPStorm开启调试模式运行断点调试,系统却无法运行,网页显示一片空白,查看Apache error.log文件,看到以下错误信息:

[php7:notice] [pid 12472:tid 1936] [client 127.0.0.1:53267] PHP Warning: Header may not contain NUL bytes in D:\www\www.bluepost.cn\index.php on line 11

既然发现问题点,那就上网找解决方法啦,结果在网上查找半天也未查找到类似问题。但是我不甘心啊,锲而不舍,不断查找,终于在xdebug官方网站bug信息中找到类似问题,提示原因为“v2.7.0RC2版本bug,升级到v2.7.0版本就解决了该问题”。

Xdebug v2.7.0RC2 bug - Header may not contain NUL bytes in
Xdebug v2.7.0RC2 bug – Header may not contain NUL bytes in

问题原因

XAMPP v3.2.3版本自带的Xdebug版本为v2.7.0RC2,而该版本却存在bug,导致debug出错。而且我在配置Xdebug时,见系统中已经有php_xdebug.dll文件,就没有下载该文件。

处理过程

既然找到问题原因,那就下载v2.7.0版本的xdebug版本试试,通过验证,该问题彻底解决,debug调试可以正常使用。

经验总结

切记在遇到问题时,一定要通过log来分析问题原因。本次遇到问题,正好是配置xdebug时出现,总以为是配置没有弄好,最后分析log信息,才找到原因是由于XAMPP自身装的Xdebug v2.7.0RC2版本有bug导致。

转载请注明:半亩方塘 » XAMPP开启Xdebug后无法运行,提示Warning: Header may not contain NUL bytes in

赞 (26)支付宝扫码打赏微信扫码打赏分享
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址