Jump to content

Recommended Posts

Posted

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

Posted (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! :P :) :dance: :dance:

Edited by TCH-MikeJ
Posted (edited)

Phillip, that code should work. :huh:

 

$_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 by TCH-Raul
Posted
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.

Posted

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

Posted

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.

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...