Jump to content

Recommended Posts

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!

 

 

Link to comment
https://forums.phpfreaks.com/topic/218211-php-as-virtual-include-shtml-displays-0/
Share on other sites

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.