Jump to content

can't find where's the problem


ballouta

Recommended Posts

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

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'

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.