473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

help with php.ini include_path?

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:

/cgi-bin/includes

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

/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.

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, php.net, 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!

Bob

Jul 27 '06 #1
2 2985
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.
Jul 27 '06 #2
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
Jul 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ramprasad A Padmanabhan | last post by:
I know it is a dummies question, But I am not able to find it on the php manual. Can anyone tell me How to set the include_path in php thanks Ram
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
3
by: mirko | last post by:
Hello, I have a problem with my include_path and I don't know why... Can anybody see the mistake? my configuration: PHP Version 4.3.11 System: Windows NT 5.0 build 2195
24
by: Paul | last post by:
I am taking over an existing app and having trouble understanding their references. They have encapsulated Pear packages in the directory structure like: /site /site/html/Pear.php...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
0
by: Bastien Continsouzas | last post by:
I am trying to set the include path for SimpleTest under Eclipse I have the following config : Eclipse : 3.2.0 PHPEclipse 1.1.8 SimpleTest plugin : 0.2.1 I ran a test I found on the...
9
by: Charles Crume | last post by:
Hello Everyone; My site was hacked the other day -- someone was able to rename my index.shtml file and put their own index.html file on my server. Not sure how it was done, but looking through...
2
by: Rob Wilkerson | last post by:
Hey all - I'm trying to create a developer-friendly environment on my production server. By that, I mean an environment where developers don't need to worry about certain things. Among those...
1
by: comp.lang.c++ | last post by:
NAME=Test PATH=../../IDE\WATCOM17\Bin LIB_PATH=../../IDE\WATCOM17\Lib INCLUDE_PATH=../../IDE\WATCOM17\Include BIN_PATH=../../Bin OBJS=$(NAME).obj LINK_FLAG= d all op inc op m op maxe=25 op...
4
by: Gordon | last post by:
Is it possible in, say, a .htaccess file, to append additional paths to the php include_path without knowing what the value of include_path is beforehand? I want to add an absolute path to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.