Page 1 of 1

include_path ignored?

Posted: Wed Jun 08, 2005 12:57 am
by newmember
hi

i have some troubles with include_path directive....

i'm on windows machine iwth php 4.3.5 and apache 1.3.
i have common.inc file that is used by many other files...
i tried to use custom php.ini file under script's home directory.
The file has only these lines:

Code: Select all

їPHP]

include_path=&quote;home;home/admin;&quote;
common.inc is located under "home" directory.

then i get this error:
Warning: main(common.inc): failed to open stream: No such file or directory in c:\apache\apache\users\home\admin\admin_common.inc on line 2 Fatal error: main(): Failed opening required 'common.inc' (include_path='.;c:\php4\pear') in c:\apache\apache\users\home\admin\admin_common.inc on line 2
common.inc is included inside admin_common.inc.

include_path='.;c:\php4\pear' <- this seems very odd... i tried to search files for this string, to find out where it comes from, but i couldn't find where it is being set...

it seems like my php.ini is totaly ignored.
Does anyone know what could be the problem?

Posted: Wed Jun 08, 2005 2:40 am
by Syranide
if you set the path yourself, the entry in php.ini is discarded (pretty logical) with the one you specified yourself.

however

include_path='.;c:\php4\pear'
-- means --
search "current folder"
search "c:\php4\pear"

hope this helps.

Posted: Wed Jun 08, 2005 3:14 am
by newmember
Syranide, i understand what
include_path='.;c:\php4\pear'
means.

i simply don't understand why i get the error..
Warning: main(common.inc): failed to open stream: No such file or directory in c:\apache\apache\users\home\admin\admin_common.inc on line 2 Fatal error: main(): Failed opening required 'common.inc' (include_path='.;c:\php4\pear') in c:\apache\apache\users\home\admin\admin_common.inc on line 2
there is a standard php.ini under c:\apache\apache.
additionally i put another
php.ini under c:\apache\apache\users\home\ with these lines:

Code: Select all

&#1111;PHP] 
include_path=&quote;home;home/admin;&quote;
so i'm expecting that if i have a php file with

Code: Select all

include_once("common.inc")
in any subfolder under c:\apache\apache\users\home\ directory then php parser should find common.inc and use it...

but that doesn't happen... :?

Posted: Wed Jun 08, 2005 3:21 am
by Syranide
aha, now I see what you mean... php.ini does not work in directories, it does only load the one specificed by the system, the only thing you can do is changing it using htaccess (apache) and setting it through there.

(warning: make sure you include paths are always absolute unless you want it to not be, could easily start messing things up otherwise)

Posted: Wed Jun 08, 2005 3:23 am
by phpScott
the php.ini file that is being used is the one that you have pointed too in your http.conf file. If your server allows .htaccess files you can try this.

Code: Select all

php_value include_path c:/apache/apache/users/home/:./:
in an .htaccess file and place the file in your home directory.

you might have to play around with the file page abit as I copied it from my linux host.

Posted: Wed Jun 08, 2005 3:31 am
by newmember
Syranide
are you 100% sure that i can use php.ini this way?
because actually i saw someone use it this way... and it worked...
strange :?

Posted: Wed Jun 08, 2005 3:55 am
by Syranide
first of "can't"

no I'm not 100%, but if that would work it would be extremely strange as it would pretty much allow people to do whatever they want as they are free to change any setting they desire, no mechanism for controlling that to my knowledge. and if possible, it would work for you :P

might be possible, but unlikely, if it doesn't work for you it simple doesn't so you'll have to find another way anyhow ;)