[PHP] relative paths with require

2004-10-20 Thread Joey Morwick
Hello, I'm experiencing a problem with PHP4.  On the server where our code
used to reside, the relative path used in an include started from the
directory in which the file containing the require statement resided.  On
our new server, the relative paths seem to start from where the first php
script in the chain of require's resides.  

An example would be three files in two directories as follows:

/test/index.php
/test/a/a.php
/test/b/b.php

index.php:  
require(a/a.php);

a.php:
require(../b/b.php);

On our old server, this would be fine, as the path searched in a.php would
start in /test/a.  On the new server, if you start processing index.php,
you will get a file not found error in a.php since it's starting from the
path /test.

I've tried every config option I can think of and am nearly ready to try to
hack in a workaround.  Does anyone know how this could be configured?

Thanks,

-- 
~Joey Morwick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] relative paths with require

2004-10-20 Thread Greg Donald
On Wed, 20 Oct 2004 09:30:20 -0400, Joey Morwick
[EMAIL PROTECTED] wrote:
 Hello, I'm experiencing a problem with PHP4.  On the server where our code
 used to reside, the relative path used in an include started from the
 directory in which the file containing the require statement resided.  On
 our new server, the relative paths seem to start from where the first php
 script in the chain of require's resides.

Did you check the open_basedir setting?  That will make php act as you
described.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] relative paths with require

2004-10-20 Thread Joey Morwick
Greg Donald wrote:

 Did you check the open_basedir setting?  That will make php act as you
 described.

We don't have open_basedir set, but our problem is slightly different.  If
you were to execute only a.php in my previous example, there would be no
error since the current directory would be /test/a.  The problem is, if you
execute index.php and then when index.php requires a.php, a.php will be
executed with /test as the current directory instead of /test/a.  We have
access to the /test directory.  If you change the link in a.php to
b/b.php instead of ../b/b.php, it will work when you execute index.php,
but not when you execute a.php by itself.  

-- 
~Joey Morwick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php