View Full Version : PHP.ini Includes QnA

Jon T
04-26-2004, 09:55 PM
In the php.ini file for Win32 Includes, it sets;

include_path = "C:\PHP\includes"

Now having this, causes problems for many users using includes, I have seen some simply disable the line as such.

;include_path = "C:\PHP\includes"


include_path = ".;C:\PHP\includes"

Now if using phpmailer, you need the includes directory active, so does the second line with the ".;C.... " simply allow both the user to set there own Includes folder and phpmailer to use the php includes folder?

TYIA for any info on this. :thumbsup:

04-27-2004, 05:51 AM
there is no reason to disable the include path , in fact it will cause more problems than it solves.

The PHP incude_path directive works the as does PATH in windows or *NIX in that you can set multiple include paths..

include_path = ".;C:\PHP\includes;c:\PHP\PEAR;C:\cygwin\bin"

etc , the ';' is the delimiter on win32 , on *NIX it is ':' e.g.

include_path = ".:/usr/local/php/includes:/usr/local/php/PEAR"

also individual scripts can alter the include_path at runtime by using ini_set()

$extra_path = '/home/user/my_funcs' ;
ini_set( 'include_path' , ini_get( 'include_path' ) . PATH_SEPARATOR . $extra_path ) ;
(PATH_SEPARATOR is a predefined PHP constant you dont need to define it)

Jon T
04-27-2004, 06:41 AM
Understood, then what is the "." doing there? if the ; is a seperator, what is "." being used for? Does this allow both the user and php include directory to be active at the same time?

That is what I am guessing at this point.

04-27-2004, 06:48 AM
Hi , the '.' translates to `look in the current working directory` e.g. relative to the calling script

Jon T
04-27-2004, 07:35 AM
WEE I HAVE A BRAIN! That is about what I had thought, I figured that the ".;" was doing that, so what you said that ; was the seperator I was wishing that the . would force the script to look locally before looking at the php/includes.