homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

What am I missing?
Nothing shows, not even error messages.

 9:32 pm on Aug 9, 2012 (gmt 0)

I'm working on a largish piece of code and all I get in the browser is a blank screen.

I added
ini_set('display_errors', '1');

but I still get no output and no errors.

If I write one line of code with a deliberate error, I see a message about syntax errors.

As soon as I add some of the functions from the new long code, I just get a blank screen.

How to find the syntax errors when there's no output and no error messages?

Even "print"ing variables and using "var dump" shows nothing (unless it's on the very simple one or two line test code).



 11:40 pm on Aug 9, 2012 (gmt 0)

Any calls to ob_start ?

Ref: [php.net...]


 11:55 pm on Aug 9, 2012 (gmt 0)

No. This is just a few functions with preg_match, str_replace and preg_replace and a few arrays.

brotherhood of LAN

 12:15 am on Aug 10, 2012 (gmt 0)

have you tried "echo 1;" near the top to see if anything is produced? If so, just keep echoing numbers until you can see where the script falls.

If there is still no output, try commenting out the lower pieces of code.

Not the best way to debug but should work.


 1:24 am on Aug 10, 2012 (gmt 0)

Can everyone assume you've done the routine checks for invisible errors? nbsp or tab for space, line-end space where there isn't supposed to be one, that kind of thing. All brackets match, nothing interlocking, all nests come out even? In short, the whole category of "D'oh!" errors that are so obvious you don't even think of them.


 1:34 am on Aug 10, 2012 (gmt 0)

Yeah. As far as I can see I've done all that.

print "hello"; on the very first line yields nothing if I add the other code after it.

I've now spent over 20 hours commenting bits of code out and still not an error message in sight.


 5:52 am on Aug 10, 2012 (gmt 0)

remove all functions/includes
run the code from a single function in your page
try to debug line by line
make sure you echo/print/var_dump something and that your function doesn't "return" an empty string
Have your full error reporting (E_ALL) in your php and htaccess file

other than that i know not any other way to debug


 10:38 am on Aug 10, 2012 (gmt 0)

So far, one missing bracket in a preg_match and a missing semi-colon.

That's brought 7 out of 8 functions to life. When I add the last one, it's a complete blank out, everything reverts to blank screen and no error messages.

Never had to add code one line at a time before.


 12:17 pm on Aug 10, 2012 (gmt 0)

Dang! An extra bracket inside one function and a missing bracket inside another.


 10:13 pm on Aug 10, 2012 (gmt 0)

:: twiddling thumbs and whistling idly ::


 10:19 pm on Aug 10, 2012 (gmt 0)

However, looking at the code as closely as I have over the last couple of days, I identified several potential bugs very early on and already fixed them along the way. Once the syntax was correct the whole thing worked exactly right, first time. I still have no idea why the simplest of syntax errors results in a completely blank screen and no error messages though. I've never spent so much time tracking down such simple errors.


 10:26 pm on Aug 10, 2012 (gmt 0)

Did you check the apache error log ? I usually keep a tail -f on that one ... and try to run the php from the command line as long as it's not too interactive -> gives you syntax errors that are IMHO easier to deal with.


 10:38 pm on Aug 10, 2012 (gmt 0)

One of those rare occasions with no log access, and couldn't override from within htaccess - and I did waste an hour or more trying to do that.


 2:15 am on Aug 11, 2012 (gmt 0)

I still have no idea why the simplest of syntax errors results in a completely blank screen

You get the same thing in javascript. It just sits there poker-faced "Neener-neener, I'm not going to give you the tiniest trace of an iota of a hint about what you did wrong or where you did it. I'll just quietly refuse to execute." So you comment-out the entire content of every single function, cancel your plans for the weekend...

When I'm trying to make sense of someone else's code, the very first thing I do is add a line break before and/or after every single bracket. And then start indenting packages. That's where you get the "Oh, oops, these two elements were supposed to be parallel."


 1:12 pm on Aug 11, 2012 (gmt 0)

I thought I had done that.

However there was a disconnect between thinking and doing.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved