0

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?

7
  • Did you reboot your web-server? Try to run script from shell php also Commented Aug 5, 2012 at 13:46
  • How do you know there an error in it? Commented Aug 5, 2012 at 13:47
  • Check display_errors ini setting too, alongside of error_reporting. Commented Aug 5, 2012 at 13:48
  • If it's a syntax error, then php -l <filename>.php from the command line should tell you where the error is Commented Aug 5, 2012 at 13:48
  • If it's a parsing error, then using ini_set() or error_reporting() won't help. Configure your php.ini or .user.ini or via .htaccess parameters. Commented Aug 5, 2012 at 13:54

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.