Not yet a big specialist of  PHP, but a rule that apply to nearly all server
side scripting languages, use global variables as less as you can.

They simplify your programer's life, but on a server that is serving a lot
of concurent sessions, it eats all the performances and ressources. It does
not explain your time problem, but it is my 2 cents before you place to much
stuff in global variables.

Thanks and regards,

----- Original Message -----
From: "M1tch" <[EMAIL PROTECTED]>
Sent: Wednesday, September 11, 2002 8:36 PM
Subject: [PHP-DB] PreCaching Db into Variables Slows it down?!??

> Grrrrrrr!
> Just spent ages (well, 2hours) on a precaching system for my PHP code that
> didn't work out!
> Hang on, I'll backtrack a bit...
> My website is using a php engine that picks at snippets of html from the
> database, and builds them up to form the page.
> A typical page may use 5 of these html snippets, each at maybe 5kb in
> I was sat thinking, looking at the debug-timer, and saw that the templates
> were one of the more time consuming aspects.
> So I said, I know, I'll save the db a bit, and at the start of the script,
> read all the templates that I'll need into a global variable, and call
> from that.
> Simple, 5 db calls put into 1, and templates taken out of memory.
> So why, oh why, has the time taken actually increased??? Does anyone have
> sufficient working knowledge of PHP to give me a hint at why this has
> happened?
> Also, am I right in thinking that as the website hits increase, the db
> be put under increasing pressure, so it serves off better being called
> once instead of 5 times (Even though more data is taken out of it??).
> It's late, my eyes are blurring, and I'm annoyed. Very annoyed!
> Regards,
> Andy
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.385 / Virus Database: 217 - Release Date: 9/4/2002

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to