p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: I'm going NUTS trying to figure this out!


Message #1 by "John Arbon" <subscriptions@c...> on Sat, 7 Sep 2002 07:03:38
I have had to reinstall PHP, Apache, and mySQL, and everything seems to be 
working fine EXCEPT the error reporting!

I KNOW I have errors because all I get is a freaking blank screen. I have 
been through the php.ini file and tried all kinds of setting on the 
error_reporting configuration, but nothing changes.

error_reporting = E_ALL
error_display = On

I'm shooting in the dark here.

I am running PHP as a .dll (I think I have that right).

I even changed it back to a CGI and STILL get no errors from ANYTHING.

Could THAT be the problem? Anyone know?

Message #2 by "John Arbon" <subscriptions@c...> on Sat, 7 Sep 2002 17:23:42
Sorry, PHP as an Apache module.

I'm running Apache 1.3.26 and PHP 4.2.2

In the php.ini file in the /winnt directory (windows 2000) I have set the 
following;

error_reporting = ALL
display_errors = On
display_startup_errors = On
log_errors = Off
track_errors = Off

As far as I know those are the relevant settings for error reporting.

I have a a short script I wrote as a test:
[php]
<?php
  echo $_POST["test"];
  $body = "<html>
             <body>
               <form method='post' action='testpost.php'>
                 <input type='text' name='test'>
                 <input type='submit' value='test'>
               </form>
             </body>
           </html>";
  echo $body;
?>
[/php]

Now, I know the script above works.

So now I introduce an error like this:
[php]
<?php
  echo $_POST["test"];
  $body = "<html>
             <body>
               <form method='post" action='testpost.php'> // <- A " after 
post, instead of a '
                 <input type='text' name='test'>
                 <input type='submit' value='test'>
               </form>
             </body>
           </html>";
  echo $body;
?>
[/php]

And then I execute the script with the error, and I get nothing but a 
completely blank screen.

Any other errors I introduce produce the same thing, EXCEPT when I take 
the "$" off of $body I get an echo of "body".

I don't remember that being normal.

I'm completely baffled by this and ANY help would be greatly appreciated.
Message #3 by "Nikolai Devereaux" <yomama@u...> on Mon, 9 Sep 2002 20:21:51 -0700
Okay, two things:

> error_reporting = ALL

This should be E_ALL.  Subtle difference, but when you specify a named
constant that doesn't exist, then PHP either ignores the directive or
assumes a value of 0 (which means NO error reporting!)

>   echo $body;
>
> Any other errors I introduce produce the same thing, EXCEPT when I take
> the "$" off of $body I get an echo of "body".
>
> I don't remember that being normal.


What you're doing here is essentially attempting to echo the value of the
predefined constant, "body".  Since this constant isn't defined in your
script, PHP treats the constant as a string literal (hence the word 'body'
in your output) and issues a warning message.

Of course, since you're not reporting any errors, you're not seeing it.


Hope this clears things up!

nik


  Return to Index