Forum Moderators: coopster

Message Too Old, No Replies

include does not work

the include directive in php gives error message

         

ledatica

5:59 pm on May 27, 2004 (gmt 0)

10+ Year Member



I am using the a php file in inetpub/wwwroot that references other php files 2 and 3 level deep in IIS - inetpub/wwwroot/dir1/dir2/ etc. the include directive in the first file "..\dir1\dir2\foo.php" does not work and gives me the warning and error messages. I even changed the include directive in php.ini to include_path = ".;c:\inetpub\wwwroot" and still getting error.

Thanks for any help

lj

Philosopher

6:03 pm on May 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What error message are you getting?

jatar_k

6:27 pm on May 27, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld ledatica,

I think your paths are wrong

I am using the a php file in inetpub/wwwroot that references other php files 2 and 3 level deep in IIS - inetpub/wwwroot/dir1/dir2/ etc. the include directive in the first file "..\dir1\dir2\foo.php"

file doing the including here
inetpub/wwwroot

file to be included here
inetpub/wwwroot/dir1/dir2/foo.php

and this is your include
"..\dir1\dir2\foo.php"

that would be trying to include
inetpub/dir1/dir2/foo.php
because of the ..\ at the beginning

try "dir1\dir2\foo.php" for your include line

all this based on whether I am understanding the issue correctly.

m_shroom

6:16 am on Jun 3, 2004 (gmt 0)

10+ Year Member



Has no one else spoted "\" is an escape charactor in php.

Proper format is relative to your home or index file

IE; include("dir/sub_dir/file.php");

coopster

3:08 pm on Jun 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, m_shroom!

True, it is an escape character during printing, regular expressions, and the like. However, in the include construct it can be a DIRECTORY_SEPARATOR [php.net]. In Windows this syntax will also work just fine for includes.

Resources:
include_path [php.net]
Strings [php.net]

ledatica

8:50 pm on Jun 9, 2004 (gmt 0)

10+ Year Member



thanks for all the help folks. I have it working now.

lj