PHP Page showing no errors, just blank page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

PHP Page showing no errors, just blank page

Post 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.
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: PHP Page showing no errors, just blank page

Post 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?
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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.
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: PHP Page showing no errors, just blank page

Post 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.
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: PHP Page showing no errors, just blank page

Post 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
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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.
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: PHP Page showing no errors, just blank page

Post by Marinusjvv »

You tried what Tim said?
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: PHP Page showing no errors, just blank page

Post 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?
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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.
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: PHP Page showing no errors, just blank page

Post 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;
?>
 
 
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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?
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post by dzirkelb »

I'm thinking this has to be caused by my server settings or maybe my php.ini file? Any idea on that?
dzirkelb
Forum Newbie
Posts: 15
Joined: Wed Dec 02, 2009 8:52 am

Re: PHP Page showing no errors, just blank page

Post 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!
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: PHP Page showing no errors, just blank page

Post by Marinusjvv »

Brilliant. :)
Post Reply