Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- php/apache includes
July 18, 2004, 1:33 am
rate this thread
Not sure if this is an apache configuration or a php configuration
problem, i'm hoping someone can help. I'm running a webserver on FreeBSD
consisting of apache2 and php4 among other items. I've got a site that has
an alias directive defined in httpd.conf like:
alias /include "/path/to/directory/include"
In that area i have a file header.php which contains standard information i
want displayed across my web pages. In my index file i have:
<? include "/include/header.php"; ?>
The header.php file is not being included, not sure why. Any pointers
Re: php/apache includes
Apache aliases don't affect require()/include() in PHP script. PHP loads the
file directly from the filesystem, hence we need a filesystem path. It can
be either absolute or relative. For the latter, the path is relative to the
directory which contain the running script. So if index.php is in
/path/to/directory, you would do include("include/header.php").