473,626 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2996
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.in c");' 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($includ e_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.in c");' 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($includ e_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
1877
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
5462
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
3
1907
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
5339
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 /site/html/Sigma.php /site/html/Common.php /site/html/Quickform.php /site/html/Quickform/
11
26573
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 and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
0
1877
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 SimpleTest plugin page and it worked fine http://simpletest.org/en/extension_eclipse.html
9
2399
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 the log file, I found a lots and lots of entries where an "include_path" parameter was included in the URL of the PHP page, as shown below: 69.94.36.155 - - "GET...
2
1724
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 is the include path. I have a "core" include_path set in php.ini, but most projects will require an include path of their own _in addition to_ the global include_path. Ideally, I'd like to script this directly into the virtual host configuration...
1
2160
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 q op symf
4
3809
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 directory and it's subdirectories from a .htaccess file, but I don't want to have to encode the entire current value of it and append my own path as that would mean having to change it every time it changes in php.ini or the code is deployed on a...
0
8269
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.