I have a PHP file /a/b/file.php with the line
require("../connect.php");
In connect.php there is a line
require("../config.inc.php");
This all works fine on my local server. There are a bunch of files using connect.php and they all work fine too.
However on the hosting site /a/b/file.php throws an error:
Fatal error: require() [function.require]: Failed opening required
'../config.inc.php' (include_path='.:/usr/local/php5/lib/php') in
/******/connect.php on line 3
I suspect that even though connect.php is in another folder, it's looking for it relative to /a/b. Is there a php.ini setting to change this?
Why dont you use something like:
require( dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."connect.php");
This way you will avoid problems like when you develop an app on a Unix-Like system and deploy it on a Windows systems, or viceversa.