PHP not displaying errors even though display_errors = On

前端 未结 17 1736
面向向阳花
面向向阳花 2020-12-13 01:31

I have a Ubuntu server running Apache2 with PHP 5. In the php.ini I set display_errors = On and error_reporting = E_ALL | E_STRICT, but PHP is st

17条回答
  •  孤城傲影
    2020-12-13 02:22

    Just want to add another pitfall here in case someone finds this question with a problem similar to mine.

    When you are using Chrome (Or Chromium) and PHP triggers an error in PHP code which is located inside of a HTML attribute then Chrome removes the whole HTML element so you can't see the PHP error in your browser.

    Here is an example:

    test

    When calling this code in Chrome you only get a HTML document with the starting

    tag. The rest is missing. No error message and no other HTML code after this

    . This is not a PHP issue. When you open this page in Firefox then you can see the error message (When viewing the HTML code). So this is a Chrome issue.

    Don't know if there is a workaround somewhere. When this happens to you then you have to test the page in Firefox or check the Apache error log.

提交回复
热议问题