Help please. Two site folders in wamp www folder. Includes aren't connecting

Hello. I hope that you are well and enjoying life in general.

It was recommended that I bring my situation to this forum. Yes I did search and read a lot of posts but I don’t think that I found anything that addressed this specific problem. Or if I did I didn’t understand it well enough to recognize so.

Let me preface this by saying that I am not smart enough to understand most of the responses in these forums, so you have to really gear it down for me…

I have a good working site with an index on each page, carried in as an include. I did it like this, from the advice from a forum:

<div id=“rantlet_index”>
<?php include $_SERVER[“DOCUMENT_ROOT”] . “/includes/selector01.php”; ?>
</div> <!–end rantlet_index–>

It looks like this, the index being the column on the left:

It runs fine out in the world at the web provider. It ran fine internally on my computer via wamp when the site was the only thing in wamp’s www folder.

Wanting to start another site and develop it internally via wamp, I used assorted instructions from the web to create two folders inside the wamp’s www folder, each carrying its own site.

The index.php files open fine in Chrome from each folder but the includes are not included:

Somehow wamp can display the sites in the folders inside the www folder, but it can’t follow the includes.
I’ve fiddled with this for as long as I could think of things to try, but that’s not much because of my limitations.
Does anyone have any ideas that might make this work?

Thanks

Pseu

I think your problem is that the root folder on your local machine is not the same as on your web host. So you have two options:

  1. change the include path on your local machine to point to where the files are located
  2. configure Apache on your local machine to work like the web host does.

The second way is a little more complex, but not too hard; and its advantage is that you don’t have to change anything when you upload your code to your web host. Here is a little tutorial on how to set things up on Windows:

http://foundationphp.com/tutorials/apache22_vhosts.php

Ralph seems to have the right approach but a simple reminder might help you: Using WAMP (or any other canned app like it), you must stay within the localhost directory (www) for files to be available (as links)

The only exception to this if you modify the config/httpd.conf to include config/extras/httpd-vhosts.conf, the config/extras/httpd-vhosts.conf and your system32/drivers/etc/hosts file to create a virtual host (then restart Apache) for your different “websites”. If that sounds like too much work, stay within the www directory!

Regards,

DK

So in wamp, if I want to create multiple sites, I put each site’s folder inside the wamp/www folder? That’s what I did, but apparently there’s more to it than that…

The only exception to this if you modify the config/httpd.conf to include config/extras/httpd-vhosts.conf, the config/extras/httpd-vhosts.conf and your system32/drivers/etc/hosts file to create a virtual host (then restart Apache) for your different “websites”. If that sounds like too much work, stay within the www directory!

I think that that’s what I did with the first three online methods that I tried, although I can’t guarantee that what they were telling me to do is exactly the same as what you’re mentioning.

I’ll try the foundationphp.com method that Ralph referred this weekend. They say to make the folder that holds the virtual hosts to be at the top of the pile; c:/folderthatholdsthevirtualhosts . I guess with wamp I shouldn’t do that?

MP

MP,

With VirtualHosts, you can put the DocumentRoot of the VirtualHost anywhere you want. Obviously, they won’t work as localhost so be sure that you don’t use a valid domain name, e.g., I use:

# httpd-vhosts.conf
<VirtualHost 127.0.0.1:80>
ServerName dk
DocumentRoot W:/DK
ServerPath W:/DK
</VirtualHost>

# hosts
127.0.0.1 DK

Be sure to run your text editor in administrator mode (Windows) for the hosts file, Apache’s httpd-vhosts.conf (and enabling code in the httpd.conf), too, if they’re in a Windows protected directory.

Regards,

DK

Whoa, now this is something I’ve never heard of…
Could this be something that all these sites with all these instructions just don’t mention?

How do I tell the difference if the text that I write appears in the files just like any other text?

Mp,

That’s been a major PITA since Vista came out. However, that’s a good reason to install Apache (et al - except MySQL which runs as a service) in directories other than Program Files and Windows. It was a well-kept secret (that M$ was finally taking security seriously?) and sure made me change my locations.

How can you tell? Save then reopen and see whether the text was saved.

Regards,

DK

Well, I went through the procedure outlined at
http://foundationphp.com/tutorials/apache22_vhosts.php
step by step, inch by inch…and it still cheerfully continues not to work.

I have to think that this is some php thing that makes it work in
wamp\www\somefile.php but not in wamp\www\somefile\somefile.php .
The site works at the web provider in the Internet.
The site works when it is in wamp\www .

The page displays but the php index on the page does not.

. . . . . . . . . . .

I have tried to understand dots and slashes many times, but I am not up to it.

Is there anything about moving everything to another folder that would short out this

. . . . . . . . . . .

Is there some wamp setting that nobody has thought of?

. . . . . . . . . . .

Oh, I’m in Windows XP sp3. I still haven’t heard a reason not to be.

Mp,

I don’t know about WAMP but, with the real daemons, you’d simply edit httpd.conf to include the extra/httpd-vhost.conf file (it should be commented out at the end), edit the extra/httpd-vhost.conf file to include your localdomain (as above) and edit your Windows/system32/drivers/etc/hosts file (as Administrator) to include 127.0.0.1 localdomain (for each of your localhost’s virtual domains) and restart Apache. It should be the same with WAMP.

Regards,

DK

Well, yeah.
That’s what everyone has been saying all along.
That’s what I’ve been doing all along, four ways following four people’s sites including foundationphp.
That’s what hasn’t been working all along.

Maybe I’m opening the file incorrectly?
What should I be typing into the browser to open the internal site?

P