RE: [PHP] Really slow include
| From: | Rance Hall | Date: | Tue, 02 Apr 2002 21:40:47 +0000 |
| Subject: | RE: [PHP] Really slow include | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-91224@lists.php.net to get a copy of this message | ||
try replacing your include with the full data path to the header file rather than a URL, php has to
establish a http connect and download your header file before proceeding.
require ("/path/to/file/header.htm")
sometimes depending on what web server software you are using, you may need to do it like this
require ("./path/to/file/header.htm")
note the "." in front of the path
Rance Hall
308.238.2455
Internal Office Extensions: 2455 or 6655
PC Programmer, The Buckle, Inc.
rance.hall@buckle.com
-----Original Message-----
From: anti-blank [mailto:anti@anti-blank.com]
Sent: Tuesday, April 02, 2002 3:38 PM
To: php-general@lists.php.net
Subject: [PHP] Really slow include
I have a header section for my website and I'd like to include it into each page. Since this
is where
I'm housing all of my navagation. Here is my problem though. I have the header tables sitting
in a page
header.htm. I'm calling it as so:
<?
require ("header.htm")
?>
This works fine as long as I stay in the main folder /htdocs where the header.htm file is.
The problem lies when I go any deeper. I tried replacing the link with:
<?
require ("/header.htm")
?>
Hoping that would put it back to the /htdocs folder as it works for my standard links. Instead
I get this:
Fatal error: Failed opening required '/header.htm'
(include_path='.:/usr/local/lib/php') in /www/foo/htdocs/foo/index_test.php on line 82
I've tried correcting it by including the full path:
<?
require ("http://www.foo.com/header.htm")
?>
This does work but it's so amazingly slow. Even on my cable connection it will take 20-30
seconds
to load this. I've switched back and forth between require and include with no change in
speed. Anyone
have a suggestion or an idea on why my load time is suffering so much?
I hope all of that was clear enough.
Thanks
anti-blank