Re: Problem using Include Function with PHP5/Apache2.0/W2K3 Server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Including with "/something.php" will in fact include "c:\something.php".
The root in PHP is NOT the website directory but the drive the sites resides on.


Tip: define a constant set to your website's root, and use that root in every include, so that it's absolute and no longer relative.
Tip2: put all your include files in a directory like "includes" and set the php directory include_path to it, so that you can include the file "includes/xxx.php" like this "include('xxx.php');"


Have fun!
Chris.


Dave Adler wrote:
I am new to PHP and Apache. I am trying to use the include function to include a file that has my web page header and menu, similar to what I used to do with SSI.

So I have a file called menu.inc that is in the /includes folder off of the doc root.

the file has HTML in it to display a menu and header

IN my main page, I have the line

<?php include("/includes/menu.inc"); ?>

Which I would expect to insert the HTMP from menu.inc at the location of the line of code.

The content of the include file doesn't display. Instead, I get a link that says function.main and below that I get a link that says function.include

I can run other PHP code with no problem. The include files are in a folder below the doc root called Includes.

This is running on Windows 2003 Server. I did a default install of Apache 2.0 and PHP 5.

This is probably a settig in httpd.conf or php.ini but I can't seem to find it in the docs.

Any help would be greatly appreciated.

Thanks in advance,

David

-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux