New Site With Php Include Function

windows

Guest
HI,<br /><br />I'm so happy with TCH that I've decided to move one of my websites here. I was planning to get the site working before change the DNS.<br /><br />I am trying to use a php include function but am receiving the following error:<br /><br />Warning: main(): Failed opening '/usr/local/apache/htdocs/menu.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/index.php on line 28<br /><br />Is this because the DNS needs to update before they will work?<br />The exact same page works on the real live site.<br />I have removed the username <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> <br /><br />TIA<!--content-->
<!--QuoteBegin-planetphillip+Mar 3 2004, 12:38 PM--><div class='quotetop'>QUOTE(planetphillip @ Mar 3 2004, 12:38 PM)</div><div class='quotemain'><!--QuoteEBegin-->Warning: main(): Failed opening '/usr/local/apache/htdocs/menu.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username/public_html/index.php on line 28<!--QuoteEnd--></div><!--QuoteEEnd--><br />The location of your include is incorrect.<br /><br />Is menu.php one of your files? If so, try including "menu.php" without the path, or "/home/youraccount/public_html/menu.php".<br /><br />Oh, and Welcome to the TCH Family! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /><!--content-->
WOW, Thankks for the quick reply.<br /><br />The exact code is:<br /><?php include $_SERVER['DOCUMENT_ROOT']."/menu.php"; ?><!--content-->
OK. It works with "menu.php" and no path but I want to add the code to all pages, even ones in subfolders etc.<br /><br />"/home/youraccount/public_html/menu.php" doesn't work.<br /><br />Any thoughts?<!--content-->
Phillip, that code should work. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/huh.gif" style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" /><br /><br />$_SERVER['DOCUMENT_ROOT'] should be evaluated into "/home/username/public_html", not "/usr/local/apache/htdocs".<br /><br />Can you please create a PHP file with just<br /><?php phpinfo(); ?><br />in it and check the output value of the DOCUMENT_ROOT variable under the "Apache Environment" section?<br /><br />As I said, it should read "/home/username/public_html". If it doesn't, please submit a help desk ticket so one of the admins can see what's going on.<!--content-->
<!--QuoteBegin-planetphillip+Mar 3 2004, 01:06 PM--><div class='quotetop'>QUOTE(planetphillip @ Mar 3 2004, 01:06 PM)</div><div class='quotemain'><!--QuoteEBegin-->The exact code is:<br /><?php include $_SERVER['DOCUMENT_ROOT']."/menu.php"; ?><!--QuoteEnd--></div><!--QuoteEEnd--><br />Ahh... $_SERVER['DOCUMENT_ROOT'] can't figure out your proper document root because you are using the IP address, so it can't properly interpret what virtual account you are trying to access. When your domain is changed over, it will work correctly.<!--content-->
Wow, another super fast reply. Thanks.<br /><br />I created the phpinfo.php file and the path was not correct. I will create a ticket now. Thanks for your help.<br /><br /><br />/EDIT/ Just seen TCH-MikeJ's reply. That's why I asked<br />"Is this because the DNS needs to update before they will work?"<br /><br />I Will wait until things change over.<br /><br />Thanks again.<br /><br /><br />Phillip<!--content-->
Good thinking, Mike! Thanks for stepping in, I didn't think of that possibility <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Here's what I do for testing sites, but only do this if you are pretty comfortable making changes to your system.<br /><br />If you are using Windows:<br /><br />Edit the file "C:\Windows\system32\drivers\etc\hosts" (might be "C:\winnt\...." if you are on NT).<br /><br />Add a line to that file:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->1.2.3.4      www.******<!--c2--></div><!--ec2--><br /><br />Use your new server's IP address instead of 1.2.3.4<br /><br />Save the file, close all browser windows (to make sure it's not hanging onto any name cache), and then open the browser and go to "www.******". You should be viewing your new site. Note that you won't be able to view your old site while this is in place. <br /><br />When you are done testing, edit that line back out of the hosts file.<br /><br />It's helpful when using this technique to put something on your new site's page to identify that it is the new site (just add some text somewhere that says "new site" or something) to make sure that your browser is picking up the hosts file change properly.<br /><br />Hope that helps.<!--content-->
Thanks for replying.<br /><br />I tried editing the hosts file but it doesn't seem to work. I will leave it edited and see if it makes a diffeence when I start the PC tomorrow.<br /><br />One point, currently my new host address is:<br /><a href="http://69.93.215.165/~username/" target="_blank">http://69.93.215.165/~username/</a><br /><br />I have tried it with the name and without. As I said neither seems to work.<br /><br />It's no problem though, I still pulling my hair out over some CSS.<br /><br />Thanks again<!--content-->
 
Back
Top