?
Solved

Speeding up php includes

Posted on 2005-04-08
6
Medium Priority
?
196 Views
Last Modified: 2013-11-18
hi i have a pice of code like this:
<?php


include 'http://www.sight.com/coachv4.php?coach=W';
include 'http://www.sight.com/coachv4.php?coach=X';
include 'http://www.sight.com/coachv4.php?coach=A';
include 'http://www.sight.com/coachv4.php?coach=B';
include 'http://www.sight.com/coachv4.php?coach=C';

?>

which works fine and preduces the tables created by coachv4.php fine 5 times but this is mutch slower at appering on screen (about 20 seconds) than when each item is calld separatly in internet explorer (<2 secs) i am shure there must be a way to loop the instruction over several times changing the veriable coach each time avoiding combining the entire file 5 times with sutch minor changes into a monster file

thanks for you help
0
Comment
Question by:greenbug2000
6 Comments
 
LVL 5

Expert Comment

by:prsupriya
ID: 13738615
Hi!

Is sight.com an external URL?

S:
0
 
LVL 1

Author Comment

by:greenbug2000
ID: 13738955
no but i need the html generaded by the php when its run in a browser not the php veriables etc
0
 
LVL 20

Expert Comment

by:virmaior
ID: 13740369
use a series of iframes rather loading them all as includes if this is causing load time problems

more likely, the source of your problem is malformed HTML or at least HTML that IE has no fun trying to render. (e.g. nested tables)

with nested tables in IE, the rendering won't begin until the last </TABLE>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
Promethyl earned 1000 total points
ID: 13741180

Do you have to see the contents of the files?

Perhaps a GZ Handler would benefit you. Is the problem in the execution or the band?

Also, consider readfile, since include is not necessary unless you wish to parse PHP code on coachv4.php. Doing it the way you suggest would open you up to MITM attacks.  

And a call to localhost instead of the domain would save you a DNS call.

Sounds to me like it's the band. See if it gets faster by doing :

<?
ob_start("ob_gzhandler"); // compress page ; faster

$pages = array ('http://www.sight.com/coachv4.php?coach=A','http://www.sight.com/coachv4.php?coach=B',
'http://www.sight.com/coachv4.php?coach=C','http://www.sight.com/coachv4.php?coach=Z');

foreach ($pages as $page) {
   $blackhole = file_get_contents($page);
}

 /* Regulation page stuff*/
?>
0
 
LVL 7

Expert Comment

by:Promethyl
ID: 13745857
Did this answer help you?
0
 
LVL 7

Expert Comment

by:Promethyl
ID: 13854342
<?
ob_start("ob_gzhandler"); // compress page ; faster

$pages = array ('http://localhost/coachv4.php?coach=A','http://localhost/coachv4.php?coach=B',
'http://localhost/coachv4.php?coach=C','http://localhost/coachv4.php?coach=Z');

foreach ($pages as $page) {
   $blackhole = file_get_contents($page);
}

 /* Regulation page stuff*/
?>

Also, if you have control of the server, consider a memory-based caching program, such as mmcache, eaccelerator or Zend's solution Zend Optimizer + Zend Optimizer.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question