nx2wes Posted July 19, 2011 Share Posted July 19, 2011 I'm running into a weird problem I've never experienced before. I recently switched to Netfirms hosting... I'm running PHP5. Now, for some reason, any blank pages with PHP tags are outputting 0. So, for example, <?php ?> will output 0 If there's any output whatsoever, this doesn't happen.... So <?php echo " "; ?> outputs This also doesn't happen with blank HTML pages... they just output a blank page, no 0. This is screwing with my AJAX by making 0s pop up when there are no search results, etc. I can modify my PHP.ini, but I have no idea what settings, etc., could be causing this behavior. I appreciate any thoughts or help. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/ Share on other sites More sharing options...
AyKay47 Posted July 19, 2011 Share Posted July 19, 2011 on a blank page with the 0 output, what does a "view source" show? Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244709 Share on other sites More sharing options...
nx2wes Posted July 19, 2011 Author Share Posted July 19, 2011 View source just shows "0". Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244713 Share on other sites More sharing options...
AyKay47 Posted July 19, 2011 Share Posted July 19, 2011 almost sounds like a BOM is being inserted, but I have not known it to output... Edit: as wildteen88 suggested, I would contact your host provider about this issue Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244715 Share on other sites More sharing options...
wildteen88 Posted July 19, 2011 Share Posted July 19, 2011 Have you tried contacting your host about this issue. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244716 Share on other sites More sharing options...
premiso Posted July 19, 2011 Share Posted July 19, 2011 If you post some of your code it may help. I have never really seen the "0" output, but the context can help. If all else fails, is there a problem just echoing a blank space? <?php echo ""; // or echo " "; ?> Or another option is just check for "0" in your ajax script and handle it properly. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244717 Share on other sites More sharing options...
WebStyles Posted July 19, 2011 Share Posted July 19, 2011 I've seen the 0 being outputted before, but at the end of pages that actually had content. If memory serves me well, it was an apache/headers issue, but I cannot remember any details. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244723 Share on other sites More sharing options...
nx2wes Posted July 19, 2011 Author Share Posted July 19, 2011 Thanks for all of the replies. I've sent a support ticket to my host; I'll let you know what they say. After a little more exploration, I'm inclined to agree that this is probably an Apache issue. Looks like I was putting a space in my test blank HTML page. Once I removed that space, Apache returned a 404 error on the blank HTML page. So, it looks like the server is configured to throw a 404 error for empty pages. I'm guessing this has something to do with the "0" on PHP pages. For some reason, when a page is sent through the PHP parser it's stopping the 404 error but returning a "0" when the parser output is empty. @premiso: Echoing a blank space works. I'll have to use that as a temporary work around for now. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244749 Share on other sites More sharing options...
requinix Posted July 19, 2011 Share Posted July 19, 2011 Is this page on a live website somewhere we can see? I have my suspicions as to what's happening. Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1244841 Share on other sites More sharing options...
nx2wes Posted July 22, 2011 Author Share Posted July 22, 2011 For an update: My host basically denied that the problem exists (??). It's not worth the fight, so I just implemented two work-arounds: 1. Echo " " on PHP pages providing AJAX results 2. Javascript checks for "0" and converts it to "" Quote Link to comment https://forums.phpfreaks.com/topic/242347-empty-page-outputting-0/#findComment-1246273 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.