Include .php file, flock?
Include .php file, flock?
am 13.08.2007 23:47:02 von jason
My site utilizes a header.php and footer.php, which I used to use as
an include on every other page of the site; ie,
My page
Body
Both the header.php and footer.php includes navigation, logo, the
results of a few cookies and text files, etc.
This worked out great for awhile, but as the traffic increased, it
started forcing the pages to run SLOW. And by "slow," I mean that it
could take 3 or 4 minutes for a page in my message board to open. I
was able to resolve this by taking the header.php file and put it
directly in the message board itself, eliminating the "include" on
that program.
However, this makes it a bit cumbersome to add or modify things in
that section, since now I have to do it twice. So, I'm revisiting the
idea of using a single header.php and footer.php for the entire site.
My message board has has had up to 400 accesses per second before.
That's certainly not an average, but a peak. Knowing this, is there a
smarter way to include a header.php throughout the entire site than
what I posted above?
TIA,
Jason
Re: Include .php file, flock?
am 14.08.2007 00:59:16 von Jerry Stuckle
Jason wrote:
> My site utilizes a header.php and footer.php, which I used to use as
> an include on every other page of the site; ie,
>
>
>
> My page
>
>
>
>
>
>
> Body
>
>
>
>
>
> Both the header.php and footer.php includes navigation, logo, the
> results of a few cookies and text files, etc.
>
> This worked out great for awhile, but as the traffic increased, it
> started forcing the pages to run SLOW. And by "slow," I mean that it
> could take 3 or 4 minutes for a page in my message board to open. I
> was able to resolve this by taking the header.php file and put it
> directly in the message board itself, eliminating the "include" on
> that program.
>
> However, this makes it a bit cumbersome to add or modify things in
> that section, since now I have to do it twice. So, I'm revisiting the
> idea of using a single header.php and footer.php for the entire site.
>
> My message board has has had up to 400 accesses per second before.
> That's certainly not an average, but a peak. Knowing this, is there a
> smarter way to include a header.php throughout the entire site than
> what I posted above?
>
> TIA,
>
> Jason
>
Jason,
Something's wrong. Just including a file shouldn't slow things down
that much. There's a little overhead - but not that much!
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Include .php file, flock?
am 14.08.2007 03:16:11 von tmilewski
Quick word of advice:
If you do not need to interpolate variables into strings then try to
use single quotes.
When you use double quotes the parser looks for variables contained
within the string.
If you don't have any variables within the string its faster to simply
use single quotes.
This won't necessarily help you with you problem but just a good
little fyi for the future.
IE:
Correct:
include 'header.php';
?>
Not Practical But Theoretically Correct:
$somefile = 'header.php';
include "$somefile";
?>
Re: Include .php file, flock?
am 14.08.2007 09:50:21 von Toby A Inkster
Jason wrote:
> This worked out great for awhile, but as the traffic increased, it
> started forcing the pages to run SLOW. And by "slow," I mean that it
> could take 3 or 4 minutes for a page in my message board to open.
Have you tried eAccelerator?
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 54 days, 11:28.]
Fake Steve is Dead; Long Live Fake Bob!
http://tobyinkster.co.uk/blog/2007/08/13/fake-bob/
Re: Include .php file, flock?
am 14.08.2007 11:08:26 von jason
On Aug 14, 3:50 am, Toby A Inkster
wrote:
> Jason wrote:
> > This worked out great for awhile, but as the traffic increased, it
> > started forcing the pages to run SLOW. And by "slow," I mean that it
> > could take 3 or 4 minutes for a page in my message board to open.
>
> Have you tried eAccelerator?
No, I hadn't heard of it until now. I just did a quick search, though,
and will look in to it further.
The only thing I am currently using is ob_start("ob_gzhandler");
- J
Re: Include .php file, flock?
am 14.08.2007 17:59:25 von Toby A Inkster
Jason wrote:
> The only thing I am currently using is ob_start("ob_gzhandler");
This will decrease your bandwidth, but increase your CPU usage.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 54 days, 19:38.]
Fake Steve is Dead; Long Live Fake Bob!
http://tobyinkster.co.uk/blog/2007/08/13/fake-bob/