...

View Full Version : include file above root



DoubleV
09-15-2003, 05:54 PM
i'm trying to place a file that contains db connection code above the root directory.

created a file conn.php
placed it in usr/local/lib/php/test

in php.ini i uncommented
; UNIX: "/path1:/path2"
include_path = ".:/php/test"

resterted apache.

but my code won't work.

Warning: main(conn.php) [function.main]: failed to create stream: No such file or directory in /usr/local/etc/httpd/htdocs/2003_site/resources/php/navigation.php on line 9

Warning: main() [function.main]: Failed opening 'conn.php' for inclusion (include_path='.:/php/includes') in /usr/local/etc/httpd/htdocs/2003_site/resources/php/navigation.php on line 9
error2_1

the syntax i'm using for inclusion is
include 'conn.php';

Íkii
09-15-2003, 07:09 PM
try

include_once('/usr/local/lib/php/test/conn.php');

Nightfire
09-15-2003, 07:30 PM
What's the .: do? I don't think I've ever seen that

DoubleV
09-15-2003, 07:44 PM
Originally posted by Nightfire
What's the .: do? I don't think I've ever seen that
http://www.php.net/manual/en/configuration.directives.php#ini.include-path

this is the way it was in teh php.ini file before i uncommented that line (well, and of course the directory name "test" was also modified by me)

DoubleV
09-15-2003, 07:45 PM
ok,
what finally worked was
in php.ini:

; UNIX: "/path1:/path2"
include_path = ".:/usr/local/lib/php/test"

mordred
09-15-2003, 10:09 PM
Originally posted by Nightfire
What's the .: do? I don't think I've ever seen that

They separate different directories from which files may be included, i.e. PHP first tries to search in the first directory for the desired file, then in the second after the colon, etc.
Some hosts use a centralized PEAR directory. For this usage the ability to provide several directories is crucial.

firepages
09-16-2003, 04:07 AM
Originally posted by Nightfire
What's the .: do? I don't think I've ever seen that

you probably have but on win32 the seperator is ';' so

include_path = ".;c:/why/colon/wont/workonwin32;/nother_path"

means look in '.' (same directory) or c:/why/colon/wont/work... etc



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum