This is a discussion on Error reporting within the PHP Language forums, part of the PHP Programming Forums category; I have PHP 4.3.7 running on my client's Windows 2003 server. The same computer also runs SQL ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message
news:clixc.223$0N1.156@read3.inet.fi... > 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 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 |
|
|||
|
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... > "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message > news:clixc.223$0N1.156@read3.inet.fi... > > 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 > > 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 > > |
|
|||
|
"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message news:0lkxc.266$0N1.12@read3.inet.fi... > "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message > news:a4kxc.5142$iU7.3524@newssvr22.news.prodigy.co m... > > > > 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 > > > 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> 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 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. .. > > > > > 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 > > > |
|
|||
|
On Tue, 08 Jun 2004 15:53:21 GMT, "Jani Jalkala" <jani.jalkala@mail.htk.fi>
wrote: >"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(); >> ?> > >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. 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 |
|
|||
|
Oh yes, you are right about that. Still doesn't explain why PHP doesn't
display error messages. > >> > <!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> > >> > 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 |
|
|||
|
"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message news:Rhlxc.303$0N1.259@read3.inet.fi... > "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 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. 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 |
|
|||
|
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. .. > > "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message > news:Rhlxc.303$0N1.259@read3.inet.fi... > > "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 > 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. > > 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 > > |
|
|||
|
"Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message news:pTqxc.503$0N1.250@read3.inet.fi... > "Virgil Green" <vjg@DESPAMobsydian.com> wrote in message > news:6_mxc.4967$e05.40@newssvr23.news.prodigy.com. .. > > > > "Jani Jalkala" <jani.jalkala@mail.htk.fi> wrote in message > > news:Rhlxc.303$0N1.259@read3.inet.fi... > > > "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 > > 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. > > > > 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 > > > > > 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! 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 |