PHP Includes are slow?
Posted on 28 January 2004 08:17 PM
It seems as if PHP Includes are taking a long time.
The entire code for this page is:
and the file to be included is only 3KB (give or take some bytes). Pages with multiple includes have slowed to a crawl.
Can you look into the causes of this and slap whoever is responsible (Unless it's me, then I suggest a stern talking to) ;>.
This is in the category of "Don't do that" as it's extremely inefficient... :(
What you are doing is:
browser -> Apache (test.php) <-> Apache (styles.inc)
**extremely inefficient as you are now tying up 2 Apache children to serve a simplistic request
The proper way to do it is via accessing the file directly:
Going directly to the file is lightning fast in comparison to taxing an Apache child for such a request...
You will want to recode much of your PHP files as I see they are plagued with the 'include URL' method. :(
The true underlying problem to all this is that '*.inc' files are protected by the Apache engine for obvious security reasons. Your 'include' is being denied access by the Apache child, which is causing the delay. Reworking to direct file access solves the problem and removes a ton of overhead.
The following post should explain it:
Hope this helps to guide you in the right direction...