Jump to content

browser hanging with multiple PHP #includes


Trillium

Recommended Posts

I have .shtml pages that include multiple ssi files and php files to display the page.  This was working before the hosting service upgraded. 

The system is now:  Apache 2.0.53-3.4 and PHP 5.0.4-13

I've been able to reproduce it with a very simple file.  One has one include and works fine while the second has two includes and hangs.  Multiple includes of standard .html files work okay.

---------------------------
blankfile.php
---------------------------
<?php

?>
---------------------------

test files:
---------------------------
test1.shtml
---------------------------
<html>
<head>
<title>This is a test with one php include that works fine</title>
</head>
<body>
<!--#include file="blankfile.php" -->
<p>This is a test.</p>
</body>
</html>
---------------------------

---------------------------
test2.shtml
---------------------------
<html>
<head>
<title>This is a test with two php include files that hangs</title>
</head>
<body>
<!--#include file="blankfile.php" -->
<!--#include file="blankfile.php" -->
<p>This is a test.</p>
</body>
</html>
---------------------------

What should be upgraded?  Apache or PHP?  To what version?  My hosting service is skeptical that it's his problem.

I had to disable a production system until this is fixed so any help would be appreciated.
Thanks.

- Trillium


Link to comment
Share on other sites

The code has been working for two years until the hosting service upgraded the PHP from 4 to 5.

The reason for the mixture of php and shtml is that the orginal website (which reasonably large and long standing) runs entirely off of .shtml pages.  But they wanted a shopping cart added to their website.  Rather than rewrite the entire website (which would cost a lot; they're a not-for-profit org) I made the decision to imbed the php in their .shtml pages to handle the database calls and dynamic data. 

So each page of the shopping cart, is a .shtml page which includes the standard .shtml headers, footers, and side menus, as well as include the php files to handle the cookie variables, database calls, and display of the dynamic part of the page. 

When I wrote the system, I discovered that .shtml pages could include php files and they would work, but php files couldn't include the .shtml files and work properly.  And to make matters worse, those include files change several times in the year so making them support two sets of include files is out of the question.  (They barely can change the html themselves and I have to occassionally fix their html goofs.)

I can simulate the problem with more complex examples but I wanted to demonstrate it with the most stripped down version so it would be easy to duplicate.

Will an upgrade past the current configuration do the trick?

Thanks.
LL
Link to comment
Share on other sites

Im not sure if an upgrade will work. I doubt it. Check that your php tags are opened and closed correctly.
Also - are you using short or long php tags, e.g.:
<?php

rather than <?

???
The <? short tags are disabled in php.ini in later versions IMO.

Well - your code works in my setup. Have you error reporting turned on? php could be throwing an error if you are defining variables twice or if you have two include_onces etc. etc.

-steve
Link to comment
Share on other sites

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.