问题
I've got an PHP file with an error in it, but I don't know where it is and there is no error reporting, but I enabled error reporting in php.ini and in the script.
Why can't I see the error?
回答1:
Make the first four lines of your page look like this:
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
This will override your error echoing settings elsewhere so you can track down your problem. And of course, don't forget to do a phpinfo();
if you suspect there's a missing or misconfigured dependency.
回答2:
Try enabling errors in PHP:
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
If you still don't see anything and you are using Linux and Apache try looking into /var/log/apache2/error.log
you can see the live log tail -f /var/log/apache2/error.log
来源:https://stackoverflow.com/questions/11816937/php-errors-are-not-shown