BlueSkyIS Posted November 9, 2010 Share Posted November 9, 2010 Howdy! A client's web page is .shtml and includes various PHP files via standard virtual include: <!--#include virtual="session.php" --> These PHP includes worked fine until recently, when PHP files that produce no visible output began displaying a 0 (zero). For instance, the session.php file above is here in it's entirety: <?php session_start(); ?> The include is on the first line of the .shtml file, and includes that bit of code, but displays a 0 in the browser. If I echo anything at all the 0 goes away, but of course we don't want to echo anything before the <html> tag in the .shtml file. The short-term and unacceptable solution is to echo an empty HTML comment, as follows: <?php session_start(); echo "<!-- -->"; ?> As noted, this causes the 0 to disappear but now we have <!-- --> before the HTML. Repeat: This was not happening when the .shtml and PHP was installed, and the files have not changed. Therefore, it seems that this problem is caused by a change in PHP and/or Apache configuration. Has anyone seen this and/or can anyone explain what's going on? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/218211-php-as-virtual-include-shtml-displays-0/ Share on other sites More sharing options...
MadTechie Posted November 9, 2010 Share Posted November 9, 2010 Not 100% sure but Shouldn't session.php contain a header header('content-type: text/html'); check the addtype for shtml in your apache conf AddType text/htm .shtml Quote Link to comment https://forums.phpfreaks.com/topic/218211-php-as-virtual-include-shtml-displays-0/#findComment-1132319 Share on other sites More sharing options...
BlueSkyIS Posted November 9, 2010 Author Share Posted November 9, 2010 Thanks for the help, but that did not solve the problem. Everything was working fine for at least a month or two, then suddenly 0 started showing up unless we echo something. I added that header and removed the ehco, and 0 showed up again. good fun! Quote Link to comment https://forums.phpfreaks.com/topic/218211-php-as-virtual-include-shtml-displays-0/#findComment-1132325 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.