Click to See Complete Forum and Search --> : PHP includes and Apache


clie2k
01-17-2006, 08:09 AM
I am using PHP 5.0.5 and Apache 2.0.55 (Win32) on Windows XP SP2, installed via XAMPP.

In httpd.conf document root is set to: DocumentRoot "C:/Program Files/xampp/htdocs"

In php.ini include path is set to: include_path = ".;C:\Program Files\xampp\htdocs\"

In htdocs/web/site1/index.php I have:

include ('/web/site1/global/text.php');

When viewing http://localhost/web/site1/index.php, I get the following error:

Failed opening ''/web/site1/global/content_homepage_main_index.php' for inclusion (include_path='.;C:\Program Files\xampp\htdocs\') in C:\Program Files\xampp\htdocs\web\site1\index.php on line 2

Any ideas why I'm getting this error?

Thanks in advance

bpat1434
01-20-2006, 03:10 PM
Why not use relative paths?

include('global/text.php');

If you want to use your path, use:

include($_SERVER['DOCUMENT_ROOT'].'/web/site1/global/text.php');