Page 1 of 1

XAMPP - Wordpress Vhosts.. apologies

PostPosted: 04. August 2010 20:07
by sagramor
Hello Apache friends,

I humbly ask for your help. I understand this is a much asked topic and I'm sure this pisses the regulars off. Let me say that I have tried to set up multiple wordpress sites locally over 5 times now and I simply cannot stumble upon the right configuration. I have read lots of documentation which is always slightly different.

Here is what I have done:
Installed XAMPP 1.7.3 with Apache and MySQL
My path to htdocs is C:\xampp\xampp\htdocs <--yes I know I have xampp inside an xampp folder. I have modified all my paths to reflect this.
inside \htdocs i have two folders, \site1 and \site2
Inside both of these folders, I have an index.html and a wordpress folder with all the wordpress files.
Configured my hosts file to include the following:
Code: Select all       localhost       phpmyadmin       localhost.site1       localhost.site2

My httpd-vhosts files includes the following:
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\xampp\xampp\htdocs"
ServerName localhost

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\xampp\xampp\phpmyadmin"
ServerName phpmyadmin

Code: Select all
<VirtualHost *:80>
ServerName localhost.site1
ServerAdmin webmaster@localhost
DocumentRoot "C:\xampp\xampp\htdocs\site1"

<VirtualHost *:80>
ServerName localhost.site2
ServerAdmin webmaster@localhost
DocumentRoot "C:\xampp\xampp\htdocs\site2"

Afterwards, I go to http://localhost.site1/phpmyadmin and set up a db, a user, and permissions.
Then I go into C:\xampp\xampp\htdocs\site1\wordpress\ and edit my wp-config.php file to include
Code: Select all
define('DB_NAME', 'site1');

/** MySQL database username */
define('DB_USER', 'my_username');

/** MySQL database password */
define('DB_PASSWORD', 'my_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

After all of this, when I try to go to:
I get nothing. Please help me :oops:

Re: XAMPP - Wordpress Vhosts.. apologies

PostPosted: 04. August 2010 20:34
by JonB
You get no errors in the Apache error log(s)?

Can you access HTML files correctly in both 'sites'?

Does a phpinfo.php file work right from both locations?

If you tried multiple time, did you ever get to the actual install? if so be sure to drop the databases.

If you are using WP 3.0, try 2.9.2 or the patched up 3.0.1 - 3.0 users have had many inexplicable problems - including a couple posted here.


BTW, this one should not work;

it would have to be http://localhost/wordpress/site1/wp-admin/install.php
or http://localhost.site1/wordpress/wp-admin/install.php (your second entry in the post)

the other should be (I think)

For your sanity's sake, why not make them site1 and site2 and not have them nested in the localhost's htdocs folder? :idea: (only a suggestion)


Re: XAMPP - Wordpress Vhosts.. apologies

PostPosted: 04. August 2010 21:08
by sagramor
Error Log: [Wed Aug 04 13:57:52 2010] [error] [client] File does not exist: C:/xampp/xampp/htdocs/wordpress
The HTML files do work.
The phpinfo.php does not appear to be working when i go to http://localhost.site1/phpinfo.php
no, I never got the actual install script to work.

As per your sane suggestion, you mean have C:\site1 and C:\site2?
Where would I put the xampp and wordpress folders? It was my understanding that everything HAD to be in htdocs\
oi vey!

Re: XAMPP - Wordpress Vhosts.. apologies

PostPosted: 04. August 2010 23:28
by JonB
An Apache note:

When you create vhosts, effectively you are creating new 'webspaces' BUT they are specific to Apache. The DocumentRoot directive/setting tells Apache where you want to place the files that you wish to be published via Apache. (if you look, you will see the DocumentRoot of localhost is [normally] c:\xampp\htdocs)

The phpinfo.php does not appear to be working when i go to http://localhost.site1/phpinfo.php

you did copy it (phpinfo.php) from "htdocs\xampp" into this location?
DocumentRoot "C:\xampp\xampp\htdocs\site1" :?:

here's a pic of my XAMPP devlopment server's folder


and here's the vhost directive for one of the 'sites' (the expanded one in C;\xampp\sites)

Code: Select all
<VirtualHost *:80>
    DocumentRoot "C:/xampp/sites/es.newnetenterprises"
    ErrorLog "logs/es_bravo-error.log"

I put the 'sites' folder inside c:\xammp so I could back it all up in one piece with Acronis every day (and I know where to find everything :shock: ). That was merely a convenience thing, they could be on any mapped drive.

You only need one 'htdocs/xampp' folder as all that stuff (the tools) is server-wide. You can see I placed the wordpress folder(s) right under the DocumentRoot in each case. They all work, by the way.

Generally vhosts shoulld not be nested, as it makes the Vhost(s) part of the existing site. I.E. you could reach it through http://localhost/site1.

LOL - I haven't heard 'oi vey' since last chatting with a friend of mine from Chicago (and before that since leaving NYC a long, long time ago) :mrgreen:

Good Luck