Hi
I am trying to include a simple script like this :
ini_set('include_path', ini_get('include_path').':'.dirname(__FILE__));
include('../configuration/live/database.php');
When i run the script (with sudo), PHP returns :
PHP Warning: include(../configuration/live/database.php): failed to open stream: No such file or directory in /home/adil/workspace-netbeans/trunk/applications/dudu/scripts/ejabberd_populate.php on line 17
For sake of clarification, database.php does exist at
/home/adil/workspace-netbeans/trunk/applications/dudu/configuration/live/database.php
In my script, dirname(_FILE_) returns
/home/adil/workspace-netbeans/trunk/applications/dudu/scripts
Hence, the following works :
include(dirname(__FILE__).'/../configuration/live/database.php')
What i'm trying to understand is why my code (with include_path) didn't work? Is there a way to see how the include files are being searched in the include_path?
This same script works on our production server just fine. It follows the same file hierarchy.
Note : The easiest solution is to define a 'SITE_ROOT' and prepend the includes, but that is not the reason for this post. I want to know why the above doesn't work.
PS : I am using PHP 5.3.2 on Ubuntu 10.04