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 Colin McKinnon on 07/27/06 21:21

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.

 

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

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