Re: Includes and paths confusion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nick Wilson wrote:
Hello all,
Im having some problems understanding why some requires() are failing.
Let me see if i can describe what's going on clearly...

I have this:

nick@communicontent > ls
ads/  config.inc  db.inc  funcs.inc  init.inc

where ads/ is a whole huge set of scripts from an existing setup. ads/
was originally placed on its own domain as it's a version of phpadsnew
and runs as a server all by itself.

I moved ads/ to this directory to try to troubleshoot and make things
clearer.
db.inc has these lines:


use something *like* the following:

$oldincpath = ini_get('include_path');
ini_set('include_path', 'path/to/ads/stuff:etc');

// do your 'ads' requires

ini_set('include_path', $oldincpath);

also look into the magic constant __FILE__ and the functions dirname()
and realpath(). read the manual regard how to use 'include_path'

have fun.


require_once("ads/admin/config.php");
require_once("lib-statistics.inc.php");
require_once("lib-zones.inc.php");
require_once("config.inc.php");
require_once("lib-db.inc.php");
require_once("lib-dbconfig.inc.php");

warning: main(../config.inc.php): failed to open stream: No such file or
directory in
/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php
on line 33.


Fatal error: main(): Failed opening required '../config.inc.php'
(include_path='.:/usr/lib/php') in
/var/www/localhost/vhosts/payment.communicontent.com/modules/partners/inc/ads/admin/config.php
on line 33


So, why does this not happen when ads/ is on its own domain? I can see
it has something to do with relative paths, but even when i try to work
with chdir() i still get no joy.
I just can't figure out what the issue may be, so any pointers in the
right direction would be hugely appreciated.
thankyou!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux