include??
hi, i've been facing this problem all the time..
i have this:
folder forum
-global.php
-folder admin
--config.php
folder phpresume (same level with folder forum)
-index.php
in my index.php, i include global.php:
<?php
include_once(\"../forum/global.php\");
?>
i have this error:
Warning: Unable to access ./admin/config.php in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 102
Fatal error: Failed opening required './admin/config.php' (include_path='.:') in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 102
i felt very confused because i did this include in another page, where the situation is the same...the levels of folder is also the same...but i didnt' face any problem. but why...
pls advice!!
Mark Hensler posted this at 07:45 — 9th January 2002.
He has: 4,048 posts
Joined: Aug 2000
When dealing with include() and require(), relative paths are always relative to the (top most) parent process.
This means that PHP is evaluating './admin/config.php' as relative to 'phpresume/index.php', and not '../forum/global.php'.
Try adding this to the PHP script before including global.php:
<?php
ini_set(\"include_path\", ini_get(\"include_path\") . ':/usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum');
?>
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 09:14 — 9th January 2002.
They have: 164 posts
Joined: Nov 2001
hmm...i've tried that...still getting the same error...
Mark Hensler posted this at 19:48 — 9th January 2002.
He has: 4,048 posts
Joined: Aug 2000
In the error above, you have this:
The include path is only '.', or the directory of the parent process. Does the include_path change after adding the ini_set() line?
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 01:34 — 10th January 2002.
They have: 164 posts
Joined: Nov 2001
i'm getting this error after adding in..
Warning: Unable to access ./admin/config.php in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 102
Fatal error: Failed opening required './admin/config.php' (include_path='.::/usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php') in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/ on line 102
joyce posted this at 09:51 — 10th January 2002.
They have: 164 posts
Joined: Nov 2001
errors finally gone..
this is wat i used:
<?php
chdir($DOCUMENT_ROOT . \"/forum\");
require($DOCUMENT_ROOT . \"/forum/global.php\");
?>
thanks mark!!
Mark Hensler posted this at 18:27 — 10th January 2002.
He has: 4,048 posts
Joined: Aug 2000
I think that the second error was because you have the file name in the include_path.
The inlcude_path is only suppose to indicate the directory without the trailing slash.
So, I think it saw global.php as a directory and not a file.
But anyway, you've got it working. So let's not rock the boat.
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.