IIS下运行时报错

发布于 2024-07-30 00:21:12 字数 374 浏览 4 评论 0原文

我试图让我在 IIS 下安装的 PHP 显示错误,但我一点运气都没有。 我

error_reporting(E_ALL);

在脚本中尝试过,但什么也没有显示,只是一个空白屏幕。

我尝试编辑我的 PHP.ini 文件并设置

error_reporting = E_ALL
display_errors = On

也尝试过,

error_reporting = E_ALL
display_errors = stdout

但当我的脚本抛出错误时,屏幕上根本没有显示任何内容。

有什么建议吗?

I am trying to get my install of PHP under IIS to display errors, but I'm having no luck at all. I tried

error_reporting(E_ALL);

in the script, and nothing shows up, just a blank screen.

I tried editing my PHP.ini file and setting

error_reporting = E_ALL
display_errors = On

Also tried

error_reporting = E_ALL
display_errors = stdout

but nothing is showing up on the screen at all when my scripts throw errors.

Any advice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

躲猫猫 2024-08-06 00:21:17

也许 IIS 阻止了您的错误显示。
尝试:

  • 打开inetmgr(开始->运行->inetmgr->输入)
  • 单击站点
  • 选择错误页面(双击它)
  • 在右侧单击“编辑功能设置”
  • 在出现的对话框中,选择“详细错误”。
  • 保存并关闭。
  • 重新启动 IIS 即可确定。

为像我这样的谷歌用户而发布。

Perhaps IIS is blocking your errors from displaying.
Try:

  • Open inetmgr (Start -> Run -> inetmgr -> enter)
  • click on the site
  • select error pages (double click on it)
  • on the right hand side click on “Edit Feture Settings”
  • In the dialog that appears, select “Detailed Errors”.
  • Save and close.
  • Restart IIS just to be sure.

Posted for the sake of googlers like me.

无所谓啦 2024-08-06 00:21:16

很抱歉复活了一个死帖子,但我遇到了类似的问题,并通过在我的 PHP 代码中执行此操作解决了它:

ini_set('display_errors',1);
error_reporting(E_ALL);

这消除了编辑服务器配置的需要,并且还允许我仅使用我认为有问题的方法来执行此操作。

Sorry to resurrect a dead post but I had a similar issue and solved it by doing this in my PHP code:

ini_set('display_errors',1);
error_reporting(E_ALL);

This obviated the need to edit the server config and also allowed me to do this in just the method that I thought was problematic.

转身以后 2024-08-06 00:21:15

确保您在正确的位置编辑 PHP 文件; IIS 可以在 C:\WINDOWS 中查找 php.ini 文件,而不是在 PHP ISAPI 或 CGI 模块的安装位置中查找。 检查 phpinfo() 的输出; 以确定您正在编辑正确的 php.ini 文件。 此外,您需要重新启动 IIS 服务(或整个计算机),这些更改才会生效。

Ensure that you're editing the PHP file in the correct location; IIS can look for a php.ini file in C:\WINDOWS rather than the install location of the PHP ISAPI or CGI module. Check the output of phpinfo(); to determine you're editing the correct php.ini file. Also, you need to restart the IIS service (or the computer overall) before those changes will be put into effect.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文