Jump to content

Recommended Posts

I've got a problem so fundamental I can't even say what my error message is because I don't see any errors EVER!  If my PHP or MySQL scripts don't work, I just see a blank browser page and have to dig through the code and figure out my problem by brute force.  Do I have to set a parameter somewhere or something?  I even tried installing a debugger but still I don't see anything (unless it works, of course).  I know there is probably a really simple solution but I'm a total newbie to OO programming.  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/53698-where-are-my-error-messages/
Share on other sites

<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
echo "wombat; // yes this is an intentional error
?>

 

Save as test.php, upload to your server, and execute it. Tell us what you see on screen and what is seen when you view the html source.

Please try the following:

 

if ($original_value = ini_set('display_errors', 'On'))
{
     print "<P>New display_errors value set</P>";
     print "<P>Original value: {$original_value}</P>";
}
else print "<P>Failed to set display_errors</P>";

 

The following note is regarding the behaviour of ini_set(display_errors...

 

Note:

Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

 

But there is no error with that above code... I even tested the code... something should be printed.

 

Do you have access to the php.ini file?

 

what about this:

if ($original_value = @ini_set('display_errors', 'On'))
{
     print "<P>New display_errors value set</P>";
     print "<P>Original value: {$original_value}</P>";
}
else print "<P>Failed to set display_errors</P>";

Well, now I've made a tiny bit of progress.  I took everything out of my script except for your code and it displays "Failed to set display_errors" (in fact, it does it with the "@" before ini_set or without).  So now what do I need to do?

 

And, yes, I do have access to the php.ini file.  Should I look for something there?

Now I put the following lines at the beginning:

 

error_reporting(E_ALL);

ini_set('display_errors','On');

 

and it displays "New display_errors values set"

along with a good echo message I put in later.

 

HOWEVER,

If I corrupt my good echo message with a typo, I again see nothing at all - a completely blank screen, not even the "New display..." message.  It's almost as if getting an error turns off my display_errors settings!

 

 

error_reporting  =  E_ALL  and is not commented out.

display_errors = Off  and is not commented out.

 

Sorry if those two additional lines I put in make no sense; I was just following AndyB's suggestion.

 

As you requested, here is all my code (I'm not sure what you meant by "wrapped in code tags", sorry):

 

<?php

 

error_reporting(E_ALL);

ini_set('display_errors','On');

 

if ($original_value = ini_set('display_errors', 'On'))

{

    print "<P>New display_errors value set</P>";

    print "<P>Original value: {$original_value}</P>";

}

else print "<P>Failed to set display_errors</P>";

 

echo "this is a good test message";

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.