dannyluked Posted December 8, 2009 Share Posted December 8, 2009 Hi, I have recently been using the include statement to include my side, nav and header. When I use it my site seems to slow down. I also have more proof of this as I have installed Wamp (a virtual server) to test my PHP and when including just a simple header the page slows down noticeably. I was just wondering if there is a way to speed it up or an alternate method to 'include' parts of my pages (eg header)? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/ Share on other sites More sharing options...
dgoosens Posted December 8, 2009 Share Posted December 8, 2009 this is probably because one of the scripts you are including needs a lot of resources... maybe you have an error in your scripts or an endless loop... you might want to post your scripts here so that we can check this... Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973445 Share on other sites More sharing options...
dannyluked Posted December 8, 2009 Author Share Posted December 8, 2009 Thanks for the reply, Im not sure what an endless look is and how would you stop an endless loop? PS. I made a quick header which just had a word in it, that still slowed the site down. Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973446 Share on other sites More sharing options...
dgoosens Posted December 8, 2009 Share Posted December 8, 2009 and endless loop is a loop that never ends - lol for instance while(i<1) { echo "this is an endless loop"; $i = 0; } (this is a very very basic one) Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973451 Share on other sites More sharing options...
dannyluked Posted December 8, 2009 Author Share Posted December 8, 2009 Ahhh, How do you stop an endless loop (use you example) Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973454 Share on other sites More sharing options...
PFMaBiSmAd Posted December 8, 2009 Share Posted December 8, 2009 Post an example of your include statement. Best guess is that you are using a URL instead of a file system path and your server is making a HTTP request back to itself for every include statement. Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973456 Share on other sites More sharing options...
dannyluked Posted December 8, 2009 Author Share Posted December 8, 2009 <?php include "left.php" ?> PS. What is quicker? loading left.html or left.php Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973469 Share on other sites More sharing options...
premiso Posted December 8, 2009 Share Posted December 8, 2009 The difference in loading you probably will not notice a difference (it is such a small difference), but the .html should load faster due to the simple fact it does not have to run any code it just has to display the html. This is all given that you do not have your server setup to parse .html as .php. Quote Link to comment https://forums.phpfreaks.com/topic/184411-include-statement/#findComment-973475 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.