Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 06:42 AM
Jani Jalkala
Guest
 
Posts: n/a
Default Error reporting

I have PHP 4.3.7 running on my client's Windows 2003 server. The same
computer also runs SQL Server and I am trying to connect from PHP to a
database. This fails, so I would like to track down the cause for this
failure.

However, PHP does not display error messages about the failure. I have tried
these:

php.ini:
display_errors = On

test.php:
error_reporting(E_ALL);

phpinfo() says error_reporting is set to 2047 (E_ALL).

Yet I still do not get any errors.

Even when I write arglebargle code, PHP still produces a blank HTML-page
instead of syntax error message.

Are there any other settings in addition to the two forementioned which may
affect error reporting?

-Jani


  #2  
Old July 17th, 2005, 06:42 AM
Virgil Green
Guest
 
Posts: n/a
Default Re: Error reporting

"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
news:clixc.223$0N1.156@read3.inet.fi...[color=blue]
> I have PHP 4.3.7 running on my client's Windows 2003 server. The same
> computer also runs SQL Server and I am trying to connect from PHP to a
> database. This fails, so I would like to track down the cause for this
> failure.
>
> However, PHP does not display error messages about the failure. I have[/color]
tried[color=blue]
> these:
>
> php.ini:
> display_errors = On
>
> test.php:
> error_reporting(E_ALL);
>
> phpinfo() says error_reporting is set to 2047 (E_ALL).
>
> Yet I still do not get any errors.
>
> Even when I write arglebargle code, PHP still produces a blank HTML-page
> instead of syntax error message.
>
> Are there any other settings in addition to the two forementioned which[/color]
may[color=blue]
> affect error reporting?
>
> -Jani[/color]

Does PHP code without withoug database access code run properly?

Show us your code. We are only guessing that you want to connect to SQL
Server. You only said it runs on the same box. For all I know you're trying
to access a mySQL server on some other box. You didn't say how you were
attempting to connect. ODBC? For all we know, you are using incorrect
function calls all around.

- Virgil


  #3  
Old July 17th, 2005, 06:42 AM
Jani Jalkala
Guest
 
Posts: n/a
Default Re: Error reporting

The database connection was only a reference to what I was ultimately trying
to achieve. At the moment, I don't want help with the connection problems.

My problem was about PHP not displaying error messages, even after I have
(supposedly) turned on all necessary directives in php.ini and manually with
error_reporting().

The following code in test.php:

<?php
arglebargle
?>

Does not display error messages, but this HTML output:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>


"Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
news:a4kxc.5142$iU7.3524@newssvr22.news.prodigy.co m...[color=blue]
> "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
> news:clixc.223$0N1.156@read3.inet.fi...[color=green]
> > I have PHP 4.3.7 running on my client's Windows 2003 server. The same
> > computer also runs SQL Server and I am trying to connect from PHP to a
> > database. This fails, so I would like to track down the cause for this
> > failure.
> >
> > However, PHP does not display error messages about the failure. I have[/color]
> tried[color=green]
> > these:
> >
> > php.ini:
> > display_errors = On
> >
> > test.php:
> > error_reporting(E_ALL);
> >
> > phpinfo() says error_reporting is set to 2047 (E_ALL).
> >
> > Yet I still do not get any errors.
> >
> > Even when I write arglebargle code, PHP still produces a blank HTML-page
> > instead of syntax error message.
> >
> > Are there any other settings in addition to the two forementioned which[/color]
> may[color=green]
> > affect error reporting?
> >
> > -Jani[/color]
>
> Does PHP code without withoug database access code run properly?
>
> Show us your code. We are only guessing that you want to connect to SQL
> Server. You only said it runs on the same box. For all I know you're[/color]
trying[color=blue]
> to access a mySQL server on some other box. You didn't say how you were
> attempting to connect. ODBC? For all we know, you are using incorrect
> function calls all around.
>
> - Virgil
>
>[/color]


  #4  
Old July 17th, 2005, 06:42 AM
Virgil Green
Guest
 
Posts: n/a
Default Re: Error reporting


"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
news:0lkxc.266$0N1.12@read3.inet.fi...[color=blue]
> "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
> news:a4kxc.5142$iU7.3524@newssvr22.news.prodigy.co m...[color=green]
> >
> > Does PHP code without withoug database access code run properly?
> >
> > Show us your code. We are only guessing that you want to connect to SQL
> > Server. You only said it runs on the same box. For all I know you're[/color]
> trying[color=green]
> > to access a mySQL server on some other box. You didn't say how you were
> > attempting to connect. ODBC? For all we know, you are using incorrect
> > function calls all around.
> >
> > - Virgil
> >[/color]
> The database connection was only a reference to what I was ultimately[/color]
trying[color=blue]
> to achieve. At the moment, I don't want help with the connection problems.
>
> My problem was about PHP not displaying error messages, even after I have
> (supposedly) turned on all necessary directives in php.ini and manually[/color]
with[color=blue]
> error_reporting().
>
> The following code in test.php:
>
> <?php
> arglebargle
> ?>
>
> Does not display error messages, but this HTML output:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html;
> charset=windows-1252"></HEAD>
> <BODY></BODY></HTML>[/color]

That code did exactly the same thing on my server.

This, however, gave a fatal error:

<?php
arglebargle();
?>

- Virgil



  #5  
Old July 17th, 2005, 06:42 AM
Jani Jalkala
Guest
 
Posts: n/a
Default Re: Error reporting

I would understand if PHP interpreted "arglebargle" as an undefined constant
and simply did nothing on that line, but in that case I would expect a
completely empty output, not the HTML-page it PHP seens to generate.

I have been using PHP on a server provided by our ISP for a while, and a few
years ago they removed displayed error reports due to security reasons,
after which erroneous code started to result in this same empty HTML page
instead of error messages.

Thus I am fairly sure that in my current case PHP does correctly recognize
the errors in the code, but for some reason chooses to not display the error
messages.

In any case, I tried "arglebargle();" as a function call, but that didn't
change the output at all.


"Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
news:2Jkxc.5146$ZP.436@newssvr22.news.prodigy.com. ..[color=blue]
>[color=green]
> >
> > The following code in test.php:
> >
> > <?php
> > arglebargle
> > ?>
> >
> > Does not display error messages, but this HTML output:
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <META http-equiv=Content-Type content="text/html;
> > charset=windows-1252"></HEAD>
> > <BODY></BODY></HTML>[/color]
>
> That code did exactly the same thing on my server.
>
> This, however, gave a fatal error:
>
> <?php
> arglebargle();
> ?>
>
> - Virgil
>
>
>[/color]


  #6  
Old July 17th, 2005, 06:42 AM
Andy Hassall
Guest
 
Posts: n/a
Default Re: Error reporting

On Tue, 08 Jun 2004 15:53:21 GMT, "Jani Jalkala" <jani.jalkala@mail.htk.fi>
wrote:
[color=blue]
>"Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
>news:2Jkxc.5146$ZP.436@newssvr22.news.prodigy.com ...[color=green]
>>[color=darkred]
>> >
>> > The following code in test.php:
>> >
>> > <?php
>> > arglebargle
>> > ?>
>> >
>> > Does not display error messages, but this HTML output:
>> >
>> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> > <HTML><HEAD>
>> > <META http-equiv=Content-Type content="text/html;
>> > charset=windows-1252"></HEAD>
>> > <BODY></BODY></HTML>[/color]
>>
>> That code did exactly the same thing on my server.
>>
>> This, however, gave a fatal error:
>>
>> <?php
>> arglebargle();
>> ?>[/color]
>
>I would understand if PHP interpreted "arglebargle" as an undefined constant
>and simply did nothing on that line, but in that case I would expect a
>completely empty output, not the HTML-page it PHP seens to generate.[/color]

FWIW isn't the HTML snippet above generated by IE when it gets no output, and
not generated by PHP and/or the webserver? Try viewing a blank file through a
webserver with IE - I get the snippet above in view source from IE, but from
Mozilla I get a blank screen i.e. the actual output.

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
  #7  
Old July 17th, 2005, 06:42 AM
Jani Jalkala
Guest
 
Posts: n/a
Default Re: Error reporting

Oh yes, you are right about that. Still doesn't explain why PHP doesn't
display error messages.
[color=blue][color=green][color=darkred]
> >> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> >> > <HTML><HEAD>
> >> > <META http-equiv=Content-Type content="text/html;
> >> > charset=windows-1252"></HEAD>
> >> > <BODY></BODY></HTML>
> >>[/color][/color]
> FWIW isn't the HTML snippet above generated by IE when it gets no output,[/color]
and[color=blue]
> not generated by PHP and/or the webserver? Try viewing a blank file[/color]
through a[color=blue]
> webserver with IE - I get the snippet above in view source from IE, but[/color]
from[color=blue]
> Mozilla I get a blank screen i.e. the actual output.
>
> --
> Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
> http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space[/color]


  #8  
Old July 17th, 2005, 06:42 AM
Virgil Green
Guest
 
Posts: n/a
Default Re: Error reporting


"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
news:Rhlxc.303$0N1.259@read3.inet.fi...[color=blue]
> "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
> news:2Jkxc.5146$ZP.436@newssvr22.news.prodigy.com. ..[color=green]
> >[color=darkred]
> > >
> > > The following code in test.php:
> > >
> > > <?php
> > > arglebargle
> > > ?>
> > >
> > > Does not display error messages, but this HTML output:
> > >
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > > <HTML><HEAD>
> > > <META http-equiv=Content-Type content="text/html;
> > > charset=windows-1252"></HEAD>
> > > <BODY></BODY></HTML>[/color]
> >
> > That code did exactly the same thing on my server.
> >
> > This, however, gave a fatal error:
> >
> > <?php
> > arglebargle();
> > ?>
> >
> > - Virgil
> >[/color]
> I would understand if PHP interpreted "arglebargle" as an undefined[/color]
constant[color=blue]
> and simply did nothing on that line, but in that case I would expect a
> completely empty output, not the HTML-page it PHP seens to generate.
>
> I have been using PHP on a server provided by our ISP for a while, and a[/color]
few[color=blue]
> years ago they removed displayed error reports due to security reasons,
> after which erroneous code started to result in this same empty HTML page
> instead of error messages.
>
> Thus I am fairly sure that in my current case PHP does correctly recognize
> the errors in the code, but for some reason chooses to not display the[/color]
error[color=blue]
> messages.
>
> In any case, I tried "arglebargle();" as a function call, but that didn't
> change the output at all.[/color]

Earlier, you indicated that you had display_errors on in your php.ini file.
Can you confirm that this is also true via phpinfo()? Too often I see people
look in their php.ini only to discover that something else has affected the
settings and they are not really running with those settings.

Please try the code I presented and include a phpinfo() call before the call
to the fake function. Confirm all the parameters from there and report back
along with any output resulting from the fake functions.

- Virgil


  #9  
Old July 17th, 2005, 06:42 AM
Jani Jalkala
Guest
 
Posts: n/a
Default Re: Error reporting

Ok, seems that it indeed was my mistake in configuring PHP.

Firstly, I had confused "error_reporting" for "display_errors" when I was
looking at the output from phpinfo(). You were right about that, phpinfo()
did say that display_errors is Off.

After I got that right in my head and applied them to php.ini properly (I
thought), it still didn't work.

Then I browsed through all of php.ini, and noticed that I had changed these
settings in the beginning of the file, in "About this file" section, while
later in the same file the same settings were set to Off. Thus when PHP
interpreted php.ini it took the settings appearing later in the file than my
modifications.

Thanks for your help Virgil and Andy!


"Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
news:6_mxc.4967$e05.40@newssvr23.news.prodigy.com. ..[color=blue]
>
> "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
> news:Rhlxc.303$0N1.259@read3.inet.fi...[color=green]
> > "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
> > news:2Jkxc.5146$ZP.436@newssvr22.news.prodigy.com. ..[color=darkred]
> > >
> > > >
> > > > The following code in test.php:
> > > >
> > > > <?php
> > > > arglebargle
> > > > ?>
> > > >
> > > > Does not display error messages, but this HTML output:
> > > >
> > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > > > <HTML><HEAD>
> > > > <META http-equiv=Content-Type content="text/html;
> > > > charset=windows-1252"></HEAD>
> > > > <BODY></BODY></HTML>
> > >
> > > That code did exactly the same thing on my server.
> > >
> > > This, however, gave a fatal error:
> > >
> > > <?php
> > > arglebargle();
> > > ?>
> > >
> > > - Virgil
> > >[/color]
> > I would understand if PHP interpreted "arglebargle" as an undefined[/color]
> constant[color=green]
> > and simply did nothing on that line, but in that case I would expect a
> > completely empty output, not the HTML-page it PHP seens to generate.
> >
> > I have been using PHP on a server provided by our ISP for a while, and a[/color]
> few[color=green]
> > years ago they removed displayed error reports due to security reasons,
> > after which erroneous code started to result in this same empty HTML[/color][/color]
page[color=blue][color=green]
> > instead of error messages.
> >
> > Thus I am fairly sure that in my current case PHP does correctly[/color][/color]
recognize[color=blue][color=green]
> > the errors in the code, but for some reason chooses to not display the[/color]
> error[color=green]
> > messages.
> >
> > In any case, I tried "arglebargle();" as a function call, but that[/color][/color]
didn't[color=blue][color=green]
> > change the output at all.[/color]
>
> Earlier, you indicated that you had display_errors on in your php.ini[/color]
file.[color=blue]
> Can you confirm that this is also true via phpinfo()? Too often I see[/color]
people[color=blue]
> look in their php.ini only to discover that something else has affected[/color]
the[color=blue]
> settings and they are not really running with those settings.
>
> Please try the code I presented and include a phpinfo() call before the[/color]
call[color=blue]
> to the fake function. Confirm all the parameters from there and report[/color]
back[color=blue]
> along with any output resulting from the fake functions.
>
> - Virgil
>
>[/color]


  #10  
Old July 17th, 2005, 06:43 AM
Virgil Green
Guest
 
Posts: n/a
Default Re: Error reporting


"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
news:pTqxc.503$0N1.250@read3.inet.fi...[color=blue]
> "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
> news:6_mxc.4967$e05.40@newssvr23.news.prodigy.com. ..[color=green]
> >
> > "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
> > news:Rhlxc.303$0N1.259@read3.inet.fi...[color=darkred]
> > > "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message
> > > news:2Jkxc.5146$ZP.436@newssvr22.news.prodigy.com. ..
> > > >
> > > > >
> > > > > The following code in test.php:
> > > > >
> > > > > <?php
> > > > > arglebargle
> > > > > ?>
> > > > >
> > > > > Does not display error messages, but this HTML output:
> > > > >
> > > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > > > > <HTML><HEAD>
> > > > > <META http-equiv=Content-Type content="text/html;
> > > > > charset=windows-1252"></HEAD>
> > > > > <BODY></BODY></HTML>
> > > >
> > > > That code did exactly the same thing on my server.
> > > >
> > > > This, however, gave a fatal error:
> > > >
> > > > <?php
> > > > arglebargle();
> > > > ?>
> > > >
> > > > - Virgil
> > > >
> > > I would understand if PHP interpreted "arglebargle" as an undefined[/color]
> > constant[color=darkred]
> > > and simply did nothing on that line, but in that case I would expect a
> > > completely empty output, not the HTML-page it PHP seens to generate.
> > >
> > > I have been using PHP on a server provided by our ISP for a while, and[/color][/color][/color]
a[color=blue][color=green]
> > few[color=darkred]
> > > years ago they removed displayed error reports due to security[/color][/color][/color]
reasons,[color=blue][color=green][color=darkred]
> > > after which erroneous code started to result in this same empty HTML[/color][/color]
> page[color=green][color=darkred]
> > > instead of error messages.
> > >
> > > Thus I am fairly sure that in my current case PHP does correctly[/color][/color]
> recognize[color=green][color=darkred]
> > > the errors in the code, but for some reason chooses to not display the[/color]
> > error[color=darkred]
> > > messages.
> > >
> > > In any case, I tried "arglebargle();" as a function call, but that[/color][/color]
> didn't[color=green][color=darkred]
> > > change the output at all.[/color]
> >
> > Earlier, you indicated that you had display_errors on in your php.ini[/color]
> file.[color=green]
> > Can you confirm that this is also true via phpinfo()? Too often I see[/color]
> people[color=green]
> > look in their php.ini only to discover that something else has affected[/color]
> the[color=green]
> > settings and they are not really running with those settings.
> >
> > Please try the code I presented and include a phpinfo() call before the[/color]
> call[color=green]
> > to the fake function. Confirm all the parameters from there and report[/color]
> back[color=green]
> > along with any output resulting from the fake functions.
> >
> > - Virgil
> >
> >[/color]
> Ok, seems that it indeed was my mistake in configuring PHP.
>
> Firstly, I had confused "error_reporting" for "display_errors" when I was
> looking at the output from phpinfo(). You were right about that, phpinfo()
> did say that display_errors is Off.
>
> After I got that right in my head and applied them to php.ini properly (I
> thought), it still didn't work.
>
> Then I browsed through all of php.ini, and noticed that I had changed[/color]
these[color=blue]
> settings in the beginning of the file, in "About this file" section, while
> later in the same file the same settings were set to Off. Thus when PHP
> interpreted php.ini it took the settings appearing later in the file than[/color]
my[color=blue]
> modifications.
>
> Thanks for your help Virgil and Andy![/color]

Excellent news!

phpinfo() is definitely your friend. I "often" encounter situations where a
setting has been set in multiple places in the php.ini or in the wrong
php.ini. phpinfo() will always tell you what's actually happening rather
than what you think is happening.

- Virgil


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles