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

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

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,

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 etc since they are usually setup now adays with paths that use ./ or …/ or …/…/ etc

Thanks again,

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. :wink:

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