Click to See Complete Forum and Search --> : php5 relative path configuration


chestertb
02-08-2007, 03:17 PM
I have decided to get my own server so that I can access things like the php.ini file. It's running Debian, Apache2, mySQL2 and php5.

Everything's installed, but there appears to be a relative path issue with php, which is demanding the absolute path for all file references.

For example...

in getimagesize($banner);
logo.jpg lives in the /images folder.
which means $banner ought to be either the relative path 'images/logo.jpg'
or the absolute path $_SERVER['DOCUMENT_ROOT']."/images/logo.jpg".

Only the absolute path works, with the relative path returning an error that says something like 'document is outside the allowable path (/etc/php/...)

Is the a php 5 'feature', demanding absolute paths (the relative paths work fine on my old server under php4.4.4), or is it something in my php.ini that needs changing?

Thanks
CTB

pcthug
02-08-2007, 10:24 PM
set_include_path($_SERVER['DOCUMENT_ROOT']);

getimagesize('/images/logo.jpg');

chestertb
02-08-2007, 10:51 PM
Thanks, but I'm still thinking it's a configuration issue.

I have the system configured so that my script suite lives in a folder along with all the other shared aps in usr/share.

I use a few includes, which are in the 'includes' folder

When I try the absolute path,
$pathtoroot."suite/includes/filename.inc.php"
I get an 'Unable to access /var/www/sites/user/domain.com/subdomains/www/html/wroof/includes/file.inc.php' error

When I try the real path, /usr/share/suite/includes/filename.inc.php I get
'File(/usr/share/suite/includes/style-1.inc.php) is not within the allowed path(s):'

When I try the relative path, wroof/includes/style-1.inc.php, I get
'File(/etc/php/suite/includes/style-1.inc.php) is not within the allowed path(s):'.

Any other thoughts?

TheLanyard
04-09-2008, 02:26 PM
I am also having this issue though my setup is a bit different. I'm trying to use my mac as a dev server so I've set up apache (which comes with it) and installed Marc Liyanage's PHP package. Everything works fine except my install also doesn't support relative paths but handles absolute paths fine.

Is there a chance this is configuration based?

chestertb
04-09-2008, 04:53 PM
i always use full paths now. that way, I can have confidence php will point to the right file location irrespective of server configuration.

TheLanyard
04-09-2008, 05:00 PM
Unfortunately, I don't have that option. I, too, use absolute paths when I'm writing code from scratch but in this case I'm dealing with WordPress and am trying to avoid touching the Core files. Especially since the install works fine on the other servers I've used. It's just not working when I try to install it on my apache server that is running on my mac.