PHP paths seem to be a constant problem, any help appreciated.

4 posts / 0 new
Last post
#1 Wed, 05/31/2006 - 11:25
AdamHolt

PHP paths seem to be a constant problem, any help appreciated.

Hello, My server is running Suse 10.0 with Virtualmin Unlimited, my problem seems to be paths for PHP include files.

For example a php script may have the following

include /config/settings.php And sometimes it will be something like include ./config/settings.php

This wont work unless I put in the complete path of /home/domainname/public_html/config/settings.php

Does anyone know why this is, or how to fix this?

In all the servers that I've ever been hosted on, I've never had to put an absolute path to a file but could instead use things like ./ or ../ for the includes.

Hopefully someone can tell me what I need to do to fix this on Suse 10.0

Thanks very much,

Sun, 06/07/2009 - 06:59
AdamHolt

I should mention the reason why I need to resolve this is because of hosted customers that by php scripts or have them custom made and they wont work and the customer has no idea how to go about fixing it. I've had some programmers tell the customers that it's a problem with the server and theres nothing the programmers can do about it.

As you can imagine this becomes a problem with all the customers using prebuilt scripts found at places like hotscripts.com etc since they are usually setup now adays with paths that use ./ or ../ or ../../ etc

Thanks again,

Sun, 06/07/2009 - 07:00
Joe
Joe's picture

Hey Adam,

This is probably a PHP configuration option...though I have no clue how to fix it, off-hand (I've never worked with PHP).

I'll have to look into it...I was hoping someone else would know and answer so I wouldn't have to. ;-)

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:00
matti

PHP has to know from where it's searching the file. So if you use relative paths (and programs usually do) you must have path "." listed in php.ini.

For example
include_path = .:/usr/local/lib/php:./include

Topic locked