Jump to content


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


<?php include($_SERVER['DOCUMENT_ROOT'

Recommended Posts

Here is the deal... I just switched all my websites to a new server and they are all on the same IP address whereas before each site had its own IP.

I make a call such as <?php include($_SERVER['DOCUMENT_ROOT']."/document.php");?>

What I expect from this is it will look at www.example.com/document.php as it always did before.  Instead it looks for the 'document.php' file from the first account on the IP.

Warning: main(/home/absolute/public_html/document.php): failed to open stream: No such file or directory in

/home/network/public_html/index.html on line 1

Warning: main(): Failed opening '/home/absolute/public_html/document.php' for inclusion

(include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/network/public_html/index.html on line 1

So in this case it should look for the file in the account network, but instead looks for it in the account absolute as all the domains are on the same IP now.  How in the world can I fix this?

I cannot change the code to <?php include($_DOCUMENT_ROOT."document.php");?> as if the call is made in a higher directory then the root it looks in the wrong location.

Share this post

Link to post
Share on other sites
I use $_SERVER['PHP_SELF'] when referencing itself.

So a file I call guestbook.php in a form I would make it look like


<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">


That the type of thing you want to do?

Share this post

Link to post
Share on other sites


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.