ballouta Posted July 22, 2010 Share Posted July 22, 2010 I have this directories structure ballouta cms/global.inc.php main (contains rand.php) images index.php etc... If I run the file rand.php it works 100% fine. in the index.php, i wrote: include ('./main/rand.php') I get the following errors: Warning: include(../cms/global.inc.php) [function.include]: failed to open stream: No such file or directory in /home/ahlussu/public_html/Charif/main/rand.php on line 3 Warning: include(../cms/global.inc.php) [function.include]: failed to open stream: No such file or directory in /home/ahlussu/public_html/Charif/main/rand.php on line 3 Warning: include() [function.include]: Failed opening '../cms/global.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ahlussu/public_html/Charif/main/rand.php on line 3 Kindly i want to know IF i am doing smthg wrong! Many thanks Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/ Share on other sites More sharing options...
sKunKbad Posted July 22, 2010 Share Posted July 22, 2010 how about: include 'main/rand.php'; Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089411 Share on other sites More sharing options...
ballouta Posted July 22, 2010 Author Share Posted July 22, 2010 the same problem! it is strange, i always follow the same way in my work but this time cant find the problem Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089412 Share on other sites More sharing options...
Pikachu2000 Posted July 22, 2010 Share Posted July 22, 2010 Perhaps this will do the trick: include($_SERVER['DOCUMENT_ROOT'] . '/main/rand.php'); Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089415 Share on other sites More sharing options...
ballouta Posted July 22, 2010 Author Share Posted July 22, 2010 thanks but didnt work Does this mean there's a problem on the server i am hosting on? Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089417 Share on other sites More sharing options...
PFMaBiSmAd Posted July 22, 2010 Share Posted July 22, 2010 To start with, the error is when rand.php is trying to include ../cms/global.inc.php The relative path of any relative include in rand.php is relative to main.php, not rand.php, so you would either need to use a relative path of ./cms/global.inc.php or you would need to form an absolute path using $_SERVER['DOCUMENT_ROOT'] . '/Charif/cms/global.inc.php' Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089419 Share on other sites More sharing options...
Pikachu2000 Posted July 22, 2010 Share Posted July 22, 2010 From the looks of the error message, your directory structure is /public_html/Charif/main/rand.php. Is that correct? Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089420 Share on other sites More sharing options...
ballouta Posted July 22, 2010 Author Share Posted July 22, 2010 @ Pikachu2000 yes the path /public_html/Charif/main/rand.php is 100% correct. and if I run this file it works fine! Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089422 Share on other sites More sharing options...
Pikachu2000 Posted July 22, 2010 Share Posted July 22, 2010 If this doesn't work, I'm stumped . . . include($_SERVER['DOCUMENT_ROOT'] . 'Charif/main/rand.php'); Link to comment https://forums.phpfreaks.com/topic/208503-cant-find-wheres-the-problem/#findComment-1089424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.