Page 1 of 1

understanding php processing and page output order

Posted: Mon May 14, 2007 6:44 am
by vanderlay
Hi All,

I have been using php for some time now and have got the hang of fairly high level processing including dynamic images from mysql output that leads me to the point of needing to better understand the processing /logic order of the php engine so i can increase the speed of my scripts.

so the Q i have is how is the following rendered by php,

template.php
require -> mysqldata.php to get info from db
require -> imagegd.php takes mysql data and var from template.php and resizes image then outputs to browser(no save)

Q1. a)does template.php have to wait for mysqldata.php to be fully rendered/computed before moving on to imagegd.php or
b)does imagegd.php get called immediately and has to wait for mysqldata.php to supply the info needed (i presume the (a) is correct)

Q2. once imagedgd.php has been called and an image generated is that image pushed to the browser or is the template.php rendered as html sent to browser and the browser then requests the imagegd.php script and the image is generated.

Q3. is there a good way ( i have tried ob_start("ob_gzhandler"); ) to buffer the page and wait for all images but it only seems to work on text/layout rather than graphics/fla etc.

thanks
Art

Posted: Mon May 14, 2007 7:05 am
by Begby
Think of it this way....

Wherever a require is called, its as if the code from the required file is copied and pasted into your main script. After its all pasted into one giant script the script is then executed from top to bottom one line at a time. There is no scripts waiting for other scripts to be included nor does the browser request any more php files.

Posted: Mon May 14, 2007 7:13 am
by vanderlay
thx Begby,

didnt mean to offend with dbl pst but did not know what was best forum to put it under.

Art