planetphillip Posted March 3, 2004 Posted March 3, 2004 HI, 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. I am trying to use a php include function but am receiving the following error: 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 Is this because the DNS needs to update before they will work? The exact same page works on the real live site. I have removed the username TIA Quote
MikeJ Posted March 3, 2004 Posted March 3, 2004 (edited) 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 The location of your include is incorrect. Is menu.php one of your files? If so, try including "menu.php" without the path, or "/home/youraccount/public_html/menu.php". Oh, and Welcome to the TCH Family! Edited March 3, 2004 by TCH-MikeJ Quote
planetphillip Posted March 3, 2004 Author Posted March 3, 2004 WOW, Thankks for the quick reply. The exact code is: <?php include $_SERVER['DOCUMENT_ROOT']."/menu.php"; ?> Quote
planetphillip Posted March 3, 2004 Author Posted March 3, 2004 OK. It works with "menu.php" and no path but I want to add the code to all pages, even ones in subfolders etc. "/home/youraccount/public_html/menu.php" doesn't work. Any thoughts? Quote
borfast Posted March 3, 2004 Posted March 3, 2004 (edited) Phillip, that code should work. $_SERVER['DOCUMENT_ROOT'] should be evaluated into "/home/username/public_html", not "/usr/local/apache/htdocs". Can you please create a PHP file with just <?php phpinfo(); ?> in it and check the output value of the DOCUMENT_ROOT variable under the "Apache Environment" section? 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. Edited March 3, 2004 by TCH-Raul Quote
MikeJ Posted March 3, 2004 Posted March 3, 2004 The exact code is:<?php include $_SERVER['DOCUMENT_ROOT']."/menu.php"; ?> 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. Quote
planetphillip Posted March 3, 2004 Author Posted March 3, 2004 Wow, another super fast reply. Thanks. I created the phpinfo.php file and the path was not correct. I will create a ticket now. Thanks for your help. /EDIT/ Just seen TCH-MikeJ's reply. That's why I asked "Is this because the DNS needs to update before they will work?" I Will wait until things change over. Thanks again. Phillip Quote
borfast Posted March 3, 2004 Posted March 3, 2004 Good thinking, Mike! Thanks for stepping in, I didn't think of that possibility Quote
MikeJ Posted March 3, 2004 Posted March 3, 2004 Here's what I do for testing sites, but only do this if you are pretty comfortable making changes to your system. If you are using Windows: Edit the file "C:\Windows\system32\drivers\etc\hosts" (might be "C:\winnt\...." if you are on NT). Add a line to that file: >1.2.3.4 www.****** Use your new server's IP address instead of 1.2.3.4 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. When you are done testing, edit that line back out of the hosts file. 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. Hope that helps. Quote
planetphillip Posted March 3, 2004 Author Posted March 3, 2004 Thanks for replying. 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. One point, currently my new host address is: http://69.93.215.165/~username/ I have tried it with the name and without. As I said neither seems to work. It's no problem though, I still pulling my hair out over some CSS. Thanks again Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.