AW: AW: [PHP] Cache Database-driven site

2001-03-13 Thread Joe Maier

Aaron,

this is obviously exactly what i need!!
Thanks a lot - this saved me days of work!

Joe

-Ursprungliche Nachricht-
Von: Aaron Tuller [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 13. Marz 2001 05:41
An: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Betreff: Re: AW: [PHP] Cache Database-driven site


all you need to do is wrap your pages in:

ob_start();

// your code

$page = ob_get_contents();

// write $page to a file or whatever you want to do

and then depending on if this script is being called by cron or just
when people load the page you can either do an ob_end_flush() or
ob_end_clean()

it's easy.

At first I didn't beleive output buffering was that cool, now I thnk
it's one of the best things PHP has to offer.  You can use it for a
lot of things, check it out.

-aaron

At 12:40 AM +0100 3/13/01, Joe Maier wrote:
>Aaron,
>i would love to believe what you say.
>But i couldn't find any buffering functions in the online docs.
>
>Could you please gimme a pointer on where i can find these functions
>and what's their name. Are they available in php3?
>
>Thanks a lot,
>Joe
>
>-Ursprungliche Nachricht-
>Von: Aaron Tuller [mailto:[EMAIL PROTECTED]]
>Gesendet: Montag, 12. Marz 2001 23:26
>An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Betreff: Re: [PHP] Cache Database-driven site
>
>
>At 11:19 PM +0100 3/12/01, Joachim Maier wrote:
>>To create the HTML-cache page i need to build the whole HTML-page content
>in
>>memory, instead of echoing it back to the user's browser, and finally
write
>>it to disk. That means, i have to write all HTML in php-code. I can't just
>>embed php-parts in html tags.
>
>that's not true.  see the output buffering functions.
>
>-aaron
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: AW: [PHP] Cache Database-driven site

2001-03-12 Thread Aaron Tuller

all you need to do is wrap your pages in:

ob_start();

// your code

$page = ob_get_contents();

// write $page to a file or whatever you want to do

and then depending on if this script is being called by cron or just 
when people load the page you can either do an ob_end_flush() or 
ob_end_clean()

it's easy.

At first I didn't beleive output buffering was that cool, now I thnk 
it's one of the best things PHP has to offer.  You can use it for a 
lot of things, check it out.

-aaron

At 12:40 AM +0100 3/13/01, Joe Maier wrote:
>Aaron,
>i would love to believe what you say.
>But i couldn't find any buffering functions in the online docs.
>
>Could you please gimme a pointer on where i can find these functions
>and what's their name. Are they available in php3?
>
>Thanks a lot,
>Joe
>
>-Ursprungliche Nachricht-
>Von: Aaron Tuller [mailto:[EMAIL PROTECTED]]
>Gesendet: Montag, 12. Marz 2001 23:26
>An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Betreff: Re: [PHP] Cache Database-driven site
>
>
>At 11:19 PM +0100 3/12/01, Joachim Maier wrote:
>>To create the HTML-cache page i need to build the whole HTML-page content
>in
>>memory, instead of echoing it back to the user's browser, and finally write
>>it to disk. That means, i have to write all HTML in php-code. I can't just
>>embed php-parts in html tags.
>
>that's not true.  see the output buffering functions.
>
>-aaron
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Cache Database-driven site

2001-03-12 Thread Jon Snell

There are already some caching packages out there, I'm not sure how they
perform with CGI (look into Squid).  Having each page check for a cached
version of itself sounds like a complicated approach.  Another idea is to
generate portions of your site as that don't change often from perl scripts,
and run these from cron.  Using server-side-includes can make this a much
easier process.

-Original Message-
From: Joachim Maier [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001 4:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Cache Database-driven site


Hi all,

i'm appreciating any comments on this idea:

I'm about to create a completely database driven site (mySQL).
Almost all of the output is generated from database data.

A big part of the data is rather static of nature, eg. updated once a month.
A smaller part is quite dynamic, e.g. content is added daily.

Now the problem:
My webhoster's database server (not the webserver!) is nearly breaking down
in high-traffic-times.
While static sites are performing fine, my site is almost down :-((

Here my idea:
I thought of creating a cache-mechanism where each php-page checks for the
existence of a static html-cache-page that holds its contents. When the page
is there it is read and echoed out to the browser. If it isn't there, it
shall be created automatically.

To create the HTML-cache page i need to build the whole HTML-page content in
memory, instead of echoing it back to the user's browser, and finally write
it to disk. That means, i have to write all HTML in php-code. I can't just
embed php-parts in html tags.

I'm not sure, whether this is the right way to go, as i can see some major
drawbacks of this approach, although my general php-architecture is template
oriented, which would make the approach practical.

I would really appreciate some comments on this.

Thanks in advance,
Joe



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: AW: [PHP] Cache Database-driven site

2001-03-12 Thread Andrew Hill

http://www.php.net/manual/en/ref.outcontrol.php

Regards,
Andrew


On 3/12/01 6:40 PM, "Joe Maier" <[EMAIL PROTECTED]> wrote:

> Aaron,
> i would love to believe what you say.
> But i couldn't find any buffering functions in the online docs.
> 
> Could you please gimme a pointer on where i can find these functions
> and what's their name. Are they available in php3?
> 
> Thanks a lot,
> Joe
> 
> -Ursprungliche Nachricht-
> Von: Aaron Tuller [mailto:[EMAIL PROTECTED]]
> Gesendet: Montag, 12. Marz 2001 23:26
> An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Betreff: Re: [PHP] Cache Database-driven site
> 
> 
> At 11:19 PM +0100 3/12/01, Joachim Maier wrote:
>> To create the HTML-cache page i need to build the whole HTML-page content
> in
>> memory, instead of echoing it back to the user's browser, and finally write
>> it to disk. That means, i have to write all HTML in php-code. I can't just
>> embed php-parts in html tags.
> 
> that's not true.  see the output buffering functions.
> 
> -aaron
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




AW: [PHP] Cache Database-driven site

2001-03-12 Thread Joe Maier

Aaron,
i would love to believe what you say.
But i couldn't find any buffering functions in the online docs.

Could you please gimme a pointer on where i can find these functions
and what's their name. Are they available in php3?

Thanks a lot,
Joe

-Ursprungliche Nachricht-
Von: Aaron Tuller [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 12. Marz 2001 23:26
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Betreff: Re: [PHP] Cache Database-driven site


At 11:19 PM +0100 3/12/01, Joachim Maier wrote:
>To create the HTML-cache page i need to build the whole HTML-page content
in
>memory, instead of echoing it back to the user's browser, and finally write
>it to disk. That means, i have to write all HTML in php-code. I can't just
>embed php-parts in html tags.

that's not true.  see the output buffering functions.

-aaron

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Cache Database-driven site

2001-03-12 Thread Aaron Tuller

At 11:19 PM +0100 3/12/01, Joachim Maier wrote:
>To create the HTML-cache page i need to build the whole HTML-page content in
>memory, instead of echoing it back to the user's browser, and finally write
>it to disk. That means, i have to write all HTML in php-code. I can't just
>embed php-parts in html tags.

that's not true.  see the output buffering functions.

-aaron

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Cache Database-driven site

2001-03-12 Thread Joachim Maier

Hi all,

i'm appreciating any comments on this idea:

I'm about to create a completely database driven site (mySQL).
Almost all of the output is generated from database data.

A big part of the data is rather static of nature, eg. updated once a month.
A smaller part is quite dynamic, e.g. content is added daily.

Now the problem:
My webhoster's database server (not the webserver!) is nearly breaking down
in high-traffic-times.
While static sites are performing fine, my site is almost down :-((

Here my idea:
I thought of creating a cache-mechanism where each php-page checks for the
existence of a static html-cache-page that holds its contents. When the page
is there it is read and echoed out to the browser. If it isn't there, it
shall be created automatically.

To create the HTML-cache page i need to build the whole HTML-page content in
memory, instead of echoing it back to the user's browser, and finally write
it to disk. That means, i have to write all HTML in php-code. I can't just
embed php-parts in html tags.

I'm not sure, whether this is the right way to go, as i can see some major
drawbacks of this approach, although my general php-architecture is template
oriented, which would make the approach practical.

I would really appreciate some comments on this.

Thanks in advance,
Joe



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]