You are here: Re: help with php.ini include_path? « PHP Programming Language « IT news, forums, messages
Re: help with php.ini include_path?

Posted by bobmct on 07/28/06 17:54

Colin McKinnon wrote:

> bobmct wrote:
>
>> 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.
>>
> <snip>
>>
>> /cgi-bin/includes/PayPal/
>> /cgi-bin/includes/PayPal/Stuff/
>> /cgi-bin/includes/PayPal/Stuff/more_stuff/
>> /cgi-bin/includes/PayPal/Stuff/more_stuff/etc/
>>
>> and so on.
>>
>
> 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
> /cgi-bin/includes
>
> So if we assume there are some files as follows:
>
> /cgi-bin/includes/PayPal/pp.inc
> /cgi-bin/includes/PayPal/Stuff/cc.inc
>
> then you can certainly write your script as:
>
> <?php
> include("PayPal/pp.inc");
>
> However as you may have noticed, this won't work too well if pp.inc
> contains:
> include("stuff/cc.inc");
>
> (side note if pp.inc contains 'include("cc.inc");' 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
> pp.inc:
>
> $mydir=dirname(__FILE__);
> $include_file=$mydir . "/stuff/pp.inc";
> include($include_file);
>
> HTH
>
> C.

C,

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.

Thanks,

Bob

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация