Jump to content

Recommended Posts

Hi

 

Im not sure if this is the right forum, or even the right website but i have a problem.

 

Lets say I have a file, doesnt even need to have any PHP functions in the document, could be just pure CSS / images.  If i have a copy of this file named something.html and a copy names something.php, the php one takes about 5 times longer to load than the html page.  You can see 90% of the page loads and then it sticks with the loading bar nearly fininshed, waits a while and  then pings to finished and the remaining parts of the site load (usually footer links etc).

 

This has me stumped, even has my hosts stumped.  Would any one have any idea why this may happen?

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/
Share on other sites

You would need to post the code with the problem, but I would guess that php's  output buffering is turned on the the php.ini and the content exceeds the size of the buffer and the delay is occurring when the buffer is being flushed which probably also includes the time needed to perform any compression/decompression (server/browser) on the content.

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869867
Share on other sites

Here is the full code of one page giving me the issue.  This is small scale, on fully db driven MySQL sites the problem is magnified.  This has no javascript, no inlcudes, just straight html and CSS.  The .html version comes up instantly, the .php version takes about 4 seconds to finish loading (bits appear right away but then it hangs and the rest appears).

 

I've also check the line:

 

memory_limit = 128M

 

Which i would have thought would be enough? We've checked the php process whilst testing and its not even twitching.  This is one of a few dedicated servers I have so i'm free to make pretty much any adjustments I think i need to.

 

Here's the code:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<!-- General Includes !-->
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/home.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="container">

<!-- Header !-->

<div id="header">

<div id="basket">
    	<div id="title">My Basket</div>
        <div id="price"><a href="my-basket.php">4 item(s): <strong>£454.00</strong></a></div>
</div>

    <div id="smallLinks">
<a href="index.php">Home</a> | <a href="customer-sign-in.php">Sign In</a> | <a href="customer-register.php">Register</a></div>

<img src="img/global/logo.gif" width="229" height="99" />
</div>

<div id="nav">
<div id="navbkgd">
<div id="dropdown">
<ul>
	<li><a href="#" class="navDiv">Dining Room</a>
		<ul>
			<li><a href="#">Dining Room Tables</a></li>
			<li><a href="http://www.dhtmlgoodies.com">Dining Room Chairs</a></li>
		</ul>		
	</li>
	<li class="navDiv"><a href="#" class="navDiv">Bedroom</a>
		<ul>
			<li><a href="#">Beds</a></li>
			<li><a href="#">Bedside Tables</a></li>
			<li><a href="#">Dressing Tables</a></li>                
		</ul>		
	<li class="navDiv"><a href="http://www.dhtmlgoodies.com" class="navDiv">Living Room</a>
		<ul>
			<li><a href="#">Sofas</a></li>
			<li><a href="#">Armchairs</a></li>
			<li><a href="#">Consoles</a></li>                
		</ul>		
        
	<li class="navDiv"><a href="#" class="navDiv">Chairs and Chaise Longue</a></li>
	<li class="navDiv"><a href="#" class="navDiv">Mirrors</a></li>
	<li class="navDiv"><a href="#" class="navDiv">Soft Furnishings and Accessories</a></li>
	<li><a href="#" class="endDiv">Garden and Conservatory</a></li>                        
        
</ul>
</div>
</div>

        
        
    <div id="search">
      <table border="0" cellspacing="0" cellpadding="3">
        <tr>
          <td valign="middle"> </td>
          <td valign="middle"><img src="img/global/search.gif" width="47" height="15" /></td>
          <td valign="middle"><input name="textfield2" type="text" class="searchForm" id="textfield2" value="Enter product name, code or keyword" /></td>
          <td valign="middle"><select name="select" id="select">
            <option>Search all categories</option>
          </select></td>
          <td valign="middle"><img src="img/btn/search.gif" width="85" height="24" /></td>
        </tr>
      </table>
    </div>
</div>

<!-- Main Content !-->
<div id="mainBody">

<!-- Left Menu Content !-->
    <div id="leftMenu">
	<div class="leftCatHeading">Browse By Category</div>
            <div id="categories">
                <p><a href="category-listing.php">Dining Room</a></p>
                <div class="dottedLine"></div>
                <p><a href="product-listing.php">Bedroom</a></p>
                <p class="sub-categories"><a href="product-listing.php">Cast Iron Beds</a></p>
                <p class="sub-categories"><a href="product-listing.php">Mahogany Beds</a></p>
                <p class="sub-categories"><a href="product-listing.php">Four Poster Beds</a></p>
                <p class="sub-categories"><a href="product-listing.php">Childrens Beds</a></p>                    
                <div class="dottedLine"></div>
                <p><a href="category-listing.php">Living Room</a></p>
                <div class="dottedLine"></div>
                <p><a href="category-listing.php">Chairs & Chaise Longue</a></p>
                <div class="dottedLine"></div>
                <p><a href="category-listing.php">Mirrors</a></p>
                <div class="dottedLine"></div>
                <p><a href="category-listing.php">Soft Furnishings & Accessories</a></p>
                <div class="dottedLine"></div>
                <p><a href="category-listing.php">Garden & Conservatories</a></p>
            </div>
        
<div class="leftCatHeading">Join Our Newsletter</div>
		<p>Be the first to hear about our new collections and offers.  Enter your name and email address below and click “Join”.</p>
		<form id="form1" name="form1" method="post" action="">
		  <input name="textfield3" type="text" class="newsletterForm" id="textfield3" value="Your Name" />
		  <input name="textfield" type="text" class="newsletterForm" id="textfield" value="Your Email Address" />  
		<div class="btn-newsjoin"><a href="#">JOIN</a></div>      
  </form>

	<div id="leftBanners">
	<img src="img/tmp/banner.gif" width="192" height="173" />
  <img src="img/tmp/banner.gif" width="192" height="173" /></div>

</div>	<!-- Right Menu Content !-->
    
    <div id="rightMenu">
	<div id="flash"><img src="img/tmp/flash.jpg" width="753" height="216" /></div>
        <div id="newin">
		<div class="graybarheadNew">New In...</div>
            <div id="content">


         	<!-- Start Sliding Content !-->
			<div class="sample">
                    <div class="mask1">
                        <div id="box1">

                            <span>
                            <div class="newwinItem">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td valign="top">
                                        <div class="newwinTitle">Mocca 2 Seater Sofa</div>
                                        <div class="newwinPrice">£499.00</div>
                                        <div class="newinContent">Be the first to hear about our new collections and offers.  Enter your name and email address below and click "Join".</div><br /><br />
                                        <img src="img/btn/view-item.gif" width="85" height="24" /></td>
                                        <td width="255"><img src="img/tmp/product1.jpg" width="255" height="165" /></td>
                                      </tr>
                                    </table>
							</div>
                            </span>

                            <span>
                            <div class="newwinItem">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td valign="top">
                                        <div class="newwinTitle">Mocca 2 Seater Sofa</div>
                                        <div class="newwinPrice">£499.00</div>
                                        <div class="newinContent">Be the first to hear about our new collections and offers.  Enter your name and email address below and click “Join”.</div><br /><br />
                                        <img src="img/btn/view-item.gif" width="85" height="24" /></td>
                                        <td width="255"><img src="img/tmp/product1.jpg" width="255" height="165" /></td>
                                      </tr>
                                    </table>
							</div>
                            </span>
                            
                            <span>
                            <div class="newwinItem">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td valign="top">
                                        <div class="newwinTitle">Mocca 2 Seater Sofa</div>
                                        <div class="newwinPrice">£499.00</div>
                                        <div class="newinContent">Be the first to hear about our new collections and offers.  Enter your name and email address below and click “Join”.</div><br /><br />
                                        <img src="img/btn/view-item.gif" width="85" height="24" /></td>
                                        <td width="255"><img src="img/tmp/product1.jpg" width="255" height="165" /></td>
                                      </tr>
                                    </table>
							</div>
                            </span>

                        </div>
				</div>
			</div>     




            </div>
        </div>
        
        <div id="welove">
        	<div class="graybarhead">We Love...</div>
            <div id="content"><iframe src="welove/index.html" width=250 height=220 frameborder="0" scrolling="no"></iframe></div>
        </div>
       
        <div id="rightBanners">
	<div id="banner"><img src="img/tmp/banner1.gif" width="314" height="86" /></div>
	<div id="banner2"><img src="img/tmp/banner2.gif" width="434" height="86" /></div>
        </div>
        
        <div id="welcomeText">
            <h1>Welcome to our website</h1>
            <p>some text</p>
      </div>

</div>
    
</div>
<!-- Main Body Ends !-->

<div style="clear: both;"> </div>

<!-- Footer Links !-->
<div id="footer">

<div class="footerCol">
    	<div class="footerTitle">About Us</div>
        <div class="footerContent">
          <p><a href="about-us.php">About Us</a></p>
          <p><a href="news.php">News</a></p>
          <p><a href="style-scrapbook.php">Style Scrapbook</a></p>
        </div>
    </div>

<div class="footerCol">
    	<div class="footerTitle">Orders & Shopping</div>
        <div class="footerContent">
          <p><a href="delivery-policy.php">Delivery Policy</a></p>
          <p><a href="returns-policy.php">Returns Policy</a></p>
        </div>
    </div>

<div class="footerCol">
    	<div class="footerTitle">Legal</div>
        <div class="footerContent">
          <p><a href="terms-and-conditions.php">Terms & Conditions</a></p>
          <p><a href="copyright-notice.php">Copyright Notice</a></p>
        </div>
    </div>

<div class="footerCol">
    	<div class="footerTitle">Contact Us & Feedback</div>
        <div class="footerContent">
          <p><a href="contact-us.php">Contact Us</a></p>
          <p><a href="customer-feedback.php">Customer Feedback</a></p>
        </div>
    </div>

    <div class="footerColEnd">
        <div class="footerTitle">Our Range</div>
        <div class="footerContent3">
            <p><a href="#">Dining Room</a></p>
            <p><a href="#">Living Room</a></p>
            <p><a href="#">Bedroom</a></p>
        </div>
        <div class="footerContent2">
            <p><a href="#">Chairs & Chaise Longue</a></p>
            <p><a href="#">Mirrors</a></p>
            <p><a href="#">Soft Furnishings & Accessories</a></p>
        </div>        
    </div>
    
</div>
<!-- Absolute Footer !-->
<div id="absFooter">

<div class="copyrightnotice">© 2009 </div>
<div class="smallinks">Home | Contact Us | Terms & Conditions | Delivery & Returns | About Us</div>    

</div>


<div style="clear: both;"> </div>

<!-- Container Ends !-->
</div>

</body>
</html>

 

I've put this on our Linux machine and its fine, ive also put this on our development server which is about 1/4 as powerful as the live ones (and a VPS, not true dedicated) and its fine.

 

We even just got a new server and the very first site i put on that server had the issue so it cant be anything to do with capacity.

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869880
Share on other sites

Thanks for both your replies.

 

I found the line, changed it but it didnt make a difference, I also re-started IIS to double check. Would it help if you could see the results of the phpinfo page?

 

The buffer line doesnt state Off, it states No Value - which I assume is okay?

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869906
Share on other sites

Try just setting it to ON. There is a user contributed note on a related page in the manual where someone had a problem under IIS and found that turning it on solved his problem. The default 4096 value it was set to on your server was probably too small for the amount of content and the buffer needed to be flushed multiple times (the page you posted was 14KB of raw characters.) The web server is also buffering/flushing, so there could have been a case where the web server was still waiting for more content and had to time out before actually sending the content.

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869917
Share on other sites

No joy :( 

 

I can see that the line in phpinfo has changed to 1 now, but all is the same on the loading front.

 

Someone else suggested on another forum that it could be something to do with the location of the php directory, if there is lag accessing that directory bu the stopping and starting kinda seems like a buffering process.

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869921
Share on other sites

Thanks again, but still nothing.

 

One thing i noticed by accident was this:

 

Server API CGI/FastCGI

 

We didnt do the installation of PHP on this server but we did do it on the development one which runs everything fine, and i seem to recall that ISAPI was the best installtion to go for.  Could this be making a difference?

Link to comment
https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869944
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.