Fernanditos
asked on
include function and path question
Hi,
The code attached bellow is my file test.php. It works perfect if I use it inside /board/ folder.
If I move it to the root of my site (/public_html/ folder) then get this error:
This happens because global.php require other files that are located inside /board/includes/ ...
How can I manage this issue?
How can I make that all files required by global.php to be found inside /board/includes/ ? ...
Please help!
Thank you.
The code attached bellow is my file test.php. It works perfect if I use it inside /board/ folder.
If I move it to the root of my site (/public_html/ folder) then get this error:
Warning: require(./includes/class_bootstrap.p hp) [function.require]: failed to open stream: No such file or directory in /home/eagle/public_html/bo ard/global .php on line 15
This happens because global.php require other files that are located inside /board/includes/ ...
How can I manage this issue?
How can I make that all files required by global.php to be found inside /board/includes/ ? ...
Please help!
Thank you.
<?php
include('/home/user/public_html/board/global.php');
if($vbulletin->userinfo['userid'] > 0){
echo '<a href="login.php?' . $session[sessionurl] . 'do=logout&logouthash=' . $vbulletin->userinfo['logouthash'] . '">Logout</a>';
}
?>
ASKER
I tried but there are hundreds of requires in vbulletin. Any other idea?
Create a sub-folder in board called includes and make sure that the correct scripts are in there.
Another approach is to use ini_set and ini_get to change the include_path variable
ini_set( 'include_path', '.:/home/eagle/public_html /board/:/h ome/eagle/ public_htm l/board/in cludes:' . ini_get('include_path') );
More at http://www.php.net/ini_set and http://www.php.net/ini_get
Another approach is to use ini_set and ini_get to change the include_path variable
ini_set( 'include_path', '.:/home/eagle/public_html
More at http://www.php.net/ini_set and http://www.php.net/ini_get
Some more info http://uk.php.net/manual/en/ini.core.php#ini.include-path
ASKER
I solved the problem with
chdir('/home/eagle/public_ html/board '); before the include, it was magic, working like a charm.
Thank you.
chdir('/home/eagle/public_
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't you just need to edit global.php to have the correct relevant paths to the files it is calling?
Mark.