Forum Moderators: coopster

Message Too Old, No Replies

Include wont work from home directory

PHP Include will work on any part of the site excpet the home directory

         

neo_brown

4:30 pm on Jul 29, 2004 (gmt 0)

10+ Year Member



I can include a config file from any directory within my site except from the home directory. I have tried it with the config file in the same directoy and in other directories (updating the path as and when).
NO JOY.
I have an htaccess file but it only contains mod rewrites and 301's so I dont see how this could affect it. From the errors I get it seems that no matter where I store the file it never seems to be found.
Here is the error...

Warning: main(/widget/config.php) [function.main]: failed to create stream: No such file or directory in /web/_u/_r/_b/mysite.com/public/www/template.php on line 129

Any ideas would be greatly appreciated.

Birdman

4:43 pm on Jul 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried using the SERVER, DOCUMENT_ROOT variable?

include($_SERVER["DOCUMENT_ROOT"] . "/include_file.php");

Can't remember if the slash needs to be there or not, so you may need to try it both ways.

Also, the above code assumes the include file is in root.

neo_brown

4:47 pm on Jul 29, 2004 (gmt 0)

10+ Year Member



WOW that was a quick response Im gonna have to post here more often.
Thanks I will give that a try later.

neo_brown

6:53 pm on Jul 29, 2004 (gmt 0)

10+ Year Member



Worked a charm, thanks alot