bobble Posted July 6, 2009 Share Posted July 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/ Share on other sites More sharing options...
rhodesa Posted July 6, 2009 Share Posted July 6, 2009 So, even if it's a file with JUST html in it (no PHP) then .php file takes 5 times longer to load then the .html file? Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869861 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869867 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869880 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 There is an iframe on that page, if you remove the iframe, does the symptom change? What does a phpinfo(); statement show for the output_buffering setting? Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869885 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 Removing the iframe didnt make any difference, ive had this problem with other sites I have since checked that dont anything but CSS, Divs and images. The buffer setting was: output_buffering 4096(local) 4096(master) Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869888 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 I'll bet turning off output_buffering will correct the problem. Check with a phpinof(); statement to make sure it actually gets turned off. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869891 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 Could I ask what is probably a really dim question, how do I switch it off? I couldnt find the word "buffer" at all in the php.ini file. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869900 Share on other sites More sharing options...
Philip Posted July 6, 2009 Share Posted July 6, 2009 http://www.php.net/manual/en/outcontrol.configuration.php Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869901 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869906 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869917 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869921 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 What does the phpinof() show for zlib.output_compression If it is on, try turning it off and test with output_buffering on, then off. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869931 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869944 Share on other sites More sharing options...
PFMaBiSmAd Posted July 6, 2009 Share Posted July 6, 2009 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869956 Share on other sites More sharing options...
bobble Posted July 6, 2009 Author Share Posted July 6, 2009 Okay cool, well i'll give this a crack and hope for the best. Thank you for all your help so far. Quote Link to comment https://forums.phpfreaks.com/topic/164967-solved-php-execution/#findComment-869959 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.