Good day,

The include/require path is relative to the filesystem as seen by the web
system user, not the web root.

It's designed this way so that you can put your include files someplace
where users can't fetch them, which is a recommended practice.

So, if your web root is /usr/local/www on your filesystem , then you could


If you don't put in a leading slash, it will look in the current directory.

What you were doing in your second example is asking PHP to look in the file
under your root directory.

Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-----Original Message-----
From: anti-blank [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 2:38 PM
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 ("";)

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.


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to