Page 1 of 1

PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 8:59 am
by dzirkelb
Very new to php (asp programmer), so bear with me please.

In my attempts to connect to an MS Sql Server, I have noticed that my php page is showing no errors...it just simply doesn't show anything.

Here is my test code to explain what is happening:

Code: Select all

 
<?php
echo "Test1";
stuff to break php
?> 
test2
 
Now, it is my understanding that it would do one of the following:
-display Test1 on the screen, and then an error
-display nothing but an error

(oh, where it says stuff to break php, that is the actual code)

Here is some background on our server and such:

-We are hosting the site ourselves
-Word Press Site
-path to the file / url I am entering is http://xxx/wp-content/themes/destination/test.php
-Windows 2003 server
-IIS 6.0
-php installed, I believe the newest version

The other php pages work correctly through the word press site.

Can anyone point me in the right direction so I can have my errors displayed to my screen so I can start learing PHP and do troubleshooting? I have friendly http messages turned off also.

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 9:25 am
by Marinusjvv
Well in my opinion it should display the words "test1", then the error code, then "test2", as "test2" will be within <html> tags? can you give a sample of your actual code?

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:18 am
by dzirkelb

Code: Select all

 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
echo "<p>Test1</p>";
stuff to break php
?> 
test2
 
that is the entire code on the page right now...I want the error messages to appear, but all I see is a blank white screen. Could it be because it is imbedded into a wordpress site? The page itself I mean.

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:23 am
by Marinusjvv
I do not know. how are you breaking the php? with those exact words? when i copy paste the code as is i get:

Code: Select all

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\amp1.1.3\modules\... on line 5
due to the "stuff to break php" not being echo'd or in inverted commas.

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:33 am
by timWebUK
You will need to adjust the line in your php.ini file to display errors.

Change this line so it says 'ON'.

Code: Select all

display_errors = ON

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:34 am
by dzirkelb
yup, those exact words should break php I am assuming (again, new to php); however, I receive no error message...just a blank white screen.

The error message you received is what I am looking for.

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:35 am
by Marinusjvv
You tried what Tim said?

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:37 am
by dzirkelb

Code: Select all

 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
echo "<p>Test1</p>";
?> 
test2
 
produces the correct web page:

test1

test2

so, php is working

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:38 am
by Marinusjvv
You will need to adjust the line in your php.ini file to display errors.

Change this line so it says 'ON'.

display_errors = ON
Did you try this?

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 10:53 am
by dzirkelb
Sorry, missed that post (was posting at same time)

I am sure my syntax is incorrect, but here is what I have now:

Code: Select all

 
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors' = On)
echo "<p>Test1</p>";
?> 
test2
 
blank white page is the result.

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 11:02 am
by timWebUK

Code: Select all

 
<?php
ini_set('display_errors', 1)
echo 'This line won't print - there will be an below it:';
echo 'ascsd;
?>
 
 

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 11:13 am
by dzirkelb
I'm not quite sure I am understanding what the code you posted means or what I am supposed to get from it, can you elaborate please?

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 1:05 pm
by dzirkelb
I'm thinking this has to be caused by my server settings or maybe my php.ini file? Any idea on that?

Re: PHP Page showing no errors, just blank page

Posted: Wed Dec 02, 2009 2:34 pm
by dzirkelb
I edited the php.ini to display_errors = on like suggested (didn't realize it was the php.ini to edit), and after a web restart, it shows errors now...thanks!

Re: PHP Page showing no errors, just blank page

Posted: Thu Dec 03, 2009 2:44 am
by Marinusjvv
Brilliant. :)