help with php.ini include_path?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm attempting to integrate some PayPalPro supplied modules which come with
their own directory structure.  I've installed this "directory" into my
common "working" includes directory.

However, because the supplied code uses so many levels of includes PHP is
not finding the referenced included functions.

Heres an example:

my own working includes:


and I've installed the PayPalPro supplied stuff into that directory which
then constructs:


and so on.

When I use "include_once("module_name.php"); in my program the compiler
FINDS the module but the module itself then includes more items from
further on down the tree.

I've added the recursed directories to my php.ini include_paths directive
but is this really necessary?

Does one have to include each and every directory explicitly or is there a
method to define "recurse from this directory down" somewhere?   I've
searched the docs (books, bibles, groups,, etc) and cannot seem to
come up with any other way.

Please tell me I'm crazy and that there is a more reasonable way to
accomplish this?

Advice, help appreciated!


Re: help with php.ini include_path?

bobmct wrote:

Quoted text here. Click to load it
Quoted text here. Click to load it

The first thing to note is that, if possible you shouldn't put include files
within the document root. But lets assume you don't have a choice.

So your include path has

So if we assume there are some files as follows:


then you can certainly write your script as:


However as you may have noticed, this won't work too well if

(side note if contains 'include("");' then walk away carefully
deleting all files as you go).

Simplest solution is to move all the files up a dir:

cd Paypal
mv * ..

One other solution is to add /cgi-bin/includes/PayPal to your include path.

Another way is to rewrite the files to use relative addressing, e.g. in

$include_file=$mydir . "/stuff/";



Re: help with php.ini include_path?

Colin McKinnon wrote:

Quoted text here. Click to load it


Thanks for the short explanation.  The PayPal directory structure is exactly
WHAT is supplied in the PayPal SDK and a look through their modules seems
to indicate that the structure must be maintained although their top level
"paypal" can be relative.

I was HOPING that php includes would be recursive but it appears not.  What
I actually had to do was build my php.ini's include_path to include each
and every directory in the PayPal structure, each with a fully qualified
patch (what a real pain).  Creates for a very long path.  

There's GOT to be a better and/or another way.



Site Timeline