php return 500 error but no error log

后端 未结 12 1265
挽巷
挽巷 2020-11-30 05:29

I am having an issue when I have a php application that is returning an internal server error (500) however nothing is showing up in the error log.

Now I know there

相关标签:
12条回答
  • 2020-11-30 05:52

    In the past, I had no error logs in two cases:

    1. The user under which Apache was running had no permissions to modify php_error_log file.
    2. Error 500 occurred because of bad configuration of .htaccess, for example wrong rewrite module settings. In this situation errors are logged to Apache error_log file.
    0 讨论(0)
  • 2020-11-30 05:57

    Copy and paste the following into a new .htaccess file and place it on your website's root folder :

    php_flag  display_errors                  on
    php_flag  display_startup_errors          on
    

    Errors will be shown directly in your page.

    That's the best way to debug quickly but don't use it for long time because it could be a security breach.

    0 讨论(0)
  • 2020-11-30 06:05

    For Symfony projects, be sure to check files in the project'es app/logs

    More details available on this post :
    How to debug 500 Error in Symfony 2

    Btw, other frameworks or CMS share this kind of behaviour.

    0 讨论(0)
  • 2020-11-30 06:05

    You need to enable the PHP error log.

    This is due to some random glitch in the web server when you have a php error, it throws a 500 internal error (i have the same issue).

    If you look in the PHP error log, you should find your solution.

    see here in the doc of how to enable it in the php.ini

    0 讨论(0)
  • 2020-11-30 06:08

    What happened for me when this was an issue, was that the site had used too much memory, so I'm guessing that it couldn't write to an error log or displayed the error. For clarity, it was a Wordpress site that did this. Upping the memory limit on the server showed the site again.

    0 讨论(0)
  • 2020-11-30 06:09

    Scan your source files to find @.

    From php documentation site

    Currently the "@" error-control operator prefix will even disable error reporting for critical errors that will terminate script execution. Among other things, this means that if you use "@" to suppress errors from a certain function and either it isn't available or has been mistyped, the script will die right there with no indication as to why.

    0 讨论(0)
提交回复
热议问题