php return 500 error but no error log

后端 未结 12 1263
挽巷
挽巷 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:45

    If you still have 500 error and no logs you can try to execute from command line:

    php -f file.php
    

    it will not work exactly like in a browser (from server) but if there is syntax error in your code, you will see error message in console.

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

    Here is another reason why errors might not be visible:

    I had the same issue. In my case, I had copied the source from a production environment. Hence the ENVIRONMENT variable defined in index.php was set to 'production'. This caused error_reporting to be set to 0 (no logging). Just set it to 'development' and you should start seeing error messages in apache log.

    Turned out the 500 was due to a semi colon missing in database config :-)

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

    SOLVED I struggled with this and later on, I realized that I was working on PHP 5.6, so I upgraded to PHP 7.0, then I released there were comments placed by git for conflicting codes. I found something like this in my code <<<<<<<< But solved it.

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

    Another case which happened to me, is I did a CURL to some of my pages, and got internal server error and nothing was in the apache logs, even when I enabled all error reporting.

    My problem was that in the CURL I set curl_setopt($CR, CURLOPT_FAILONERROR, true);

    Which then didn't show me my error, though there was one, this happened because the error was on a framework level and not a PHP one, so it didn't appear in the logs.

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

    Be sure your file permissions are correct. If apache doesn't have permission to read the file then it can't write to the log.

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

    Maybe something turns off error output. (I understand that you are trying to say that other scripts properly output their errors to the errorlog?)

    You could start debugging the script by determining where it exits the script (start by adding a echo 1; exit; to the first line of the script and checking whether the browser outputs 1 and then move that line down).

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