douti9253 2014-06-13 16:45
浏览 78
已采纳

Nginx + PHP:当我尝试在包含的文件中调用函数时,脚本会死掉

I've got a new server with Nginx installed instead of Apache. On that server I have a functions.php script with a list of PHP functions common in my code. My code looks something like this:

<?php
ini_set('error_reporting', E_ALL);
echo "1";
include_once('../functions.php');
echo "2";
echo getHelloWorld(); // this is found in functions.php, simply returns "hello world"
echo "3";

When I hit the page on my browser, however, all that prints is 12, indicating two things:

  1. The script died when it tried calling getHelloWorld() and
  2. The error reporting seems to have done nothing

I've tried the various different types of error reporting without success (as found here: http://www.php.net//manual/en/function.error-reporting.php) and I've also confirmed (many times) that the getHelloWorld() function is spelled correctly, error-free, etc.

I'm very new to Nginx, so if anyone can give me any clues as to what might be going on I'd really appreciate it. Thanks!

  • 写回答

1条回答 默认 最新

  • doujia2021 2014-06-13 17:58
    关注

    With ini_set('error_reporting', E_ALL); you set the level of error reporting / what is logged.

    If you want to show the errors in your script, you need to set:

    ini_set('display_errors',1);
    

    Otherwise the errors will be logged to the error log only (normally...).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器