Jump to content


[SOLVED] PHP errors not being reported


3 replies to this topic

#1 Supersword

    Young Padawan

  • Members
  • Pip
  • 12 posts
  • Gender:Male
  • Location:London

Posted 21 July 2007 - 02:05 PM

Hey there. I'm not quite sure what has happened to make this happen. but I'm not getting any errors pop up when there are errors in my script. I have been running around like a horny rabbit, looking for a solution but everything I try doesn't help.

This is the purposely created script to create an error:

<?php
ini_set('display_errors', TRUE); 

if ($_POST['submit']) {
	echo "The Postman has arrived!";
}else{
	echo "No Post today!";
?>

Obviously, it's missing the final closing brace } so I am expecting an error. The problem is, it just produces a blank page. The following properties (I think these are the important ones for error reporting) are setup like this in my php.ini file:

error_reporting  =  E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On
display_startup_errors = On

I'd appreciate any help you can give, this is driving me mad.

Thanks,
Sam.

Edited by supersword, 23 July 2007 - 04:53 AM.


#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 21 July 2007 - 09:13 PM

Make sure you are editing the correct php.ini file. I've run into that, where Windows secretly makes a copy into the Windows folder, and makes PHP read from that and not the one in its own directory. :D
Maybe that's just how I accidentally set it up when I first set-up my server, who knows, I hardly knew how to run Apache at the time, lol.


Um, I'm not quite sure what would cause it to not show errors. Try calling error_reporting() and making sure it is 6135 (the numeric value of what your error_reporting value is set to in the snippet you supplied). If it is anything but 6135, then check phpinfo() and see where your real php.ini is located.

Have you tried it without the call to display_errors() at the top? I don't quite know if 'On' in an .ini file evaluates to the constant true, so I wouldn't know if that might have something to do with it.

Also there might be a setting with Apache that might prevent errors... check your Apache error log and see if there are indeed the correct errors.

Edited by Demonslay, 21 July 2007 - 09:14 PM.


#3 Ali Imran

    Young Padawan

  • Members
  • Pip
  • 7 posts

Posted 22 July 2007 - 05:42 PM

function ini_set() modifies the ini values upto script level.

You better make sure you have
display_errors = On

in your php.ini file.

Secondly, that may not be enough and all errors may not be displaying, to enable that, make following change
error_reporting = E_ALL

E_ALL means all the erros are reported, possible values are
E_COMPILE_ERROR
E_ERROR
E_CORE_ERROR

and when more than one used, must be combined using |, such as
E_COMPILE_ERROR | E_CORE_ERROR

regard

#4 Supersword

    Young Padawan

  • Members
  • Pip
  • 12 posts
  • Gender:Male
  • Location:London

Posted 22 July 2007 - 06:31 PM

Thanks for the help guys. Basically, the server was referencing a php.ini file at another location. I've changed it over and now it works.

Thanks for the information.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users