Jump to content


<?php include($_SERVER['DOCUMENT_ROOT'

  • Please log in to reply
1 reply to this topic

#1 mihomes

  • Members
  • PipPip
  • Member
  • 17 posts

Posted 15 August 2006 - 09:30 PM

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.

#2 SharkBait

  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 15 August 2006 - 10:37 PM

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?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users