Jump to content

Recommended Posts

Hi all,

I've been humming right along developing my site locally. Until today I haven't had a set include_path in my php.ini file. Haven't needed it. This has allowed me to do the following type of include with php:

say I have directory 1 and within directory 1 I have two sub directories - a & b.

Now say I have a script that I run in directory 1.

This script includes a file in directory a, like this:

include 'a/test.php';

Now, inside of test.php I have another include statement - include 'b/test2.php';

This works great. No need to back out of the directory or anything. PHP simply finds the file in directory b.

Now, if I define the include_path in my php.ini (say for a PEAR install) - now the type of include above doesn't work AT ALL!!! I'm stumped! It will include the first file, but if the second file isn't in directory a, all of a sudden it spits out an error saying that the file can't be found anymore (and it looks in the PEAR directory).

So, is there a way to have both? I really like the standard way, in fact, most of my scripts are setup this way.

Help!!
[!--quoteo(post=365232:date=Apr 16 2006, 01:03 AM:name=mmosel)--][div class=\'quotetop\']QUOTE(mmosel @ Apr 16 2006, 01:03 AM) [snapback]365232[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi all,

I've been humming right along developing my site locally. Until today I haven't had a set include_path in my php.ini file. Haven't needed it. This has allowed me to do the following type of include with php:

say I have directory 1 and within directory 1 I have two sub directories - a & b.

Now say I have a script that I run in directory 1.

This script includes a file in directory a, like this:

include 'a/test.php';

Now, inside of test.php I have another include statement - include 'b/test2.php';

This works great. No need to back out of the directory or anything. PHP simply finds the file in directory b.

Now, if I define the include_path in my php.ini (say for a PEAR install) - now the type of include above doesn't work AT ALL!!! I'm stumped! It will include the first file, but if the second file isn't in directory a, all of a sudden it spits out an error saying that the file can't be found anymore (and it looks in the PEAR directory).

So, is there a way to have both? I really like the standard way, in fact, most of my scripts are setup this way.

[/quote]


Well - I stumbled upon the solution. It was hard to track down! But it's simple (isn't in always? no, not really)

Anyway, you just have to place a single period . and then the separator (which is either a ; or : depending upon your setup) So I just added the " . ; C:\path to pear" and now my relative includes work again. Whew!
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.