Virtual Host xampplite

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Virtual Host xampplite

Postby bettlan » 07. December 2010 02:33

Hi

Installed xampplite about 6 days ago in order to run php files, with the following steps:

Created a folder C:\xampp inside which is installed xampplite at C:\xampp\xampplite

All running okay and have secured the installation as helpfully suggested here. Can open localhost but would like to open a site being built on my PC. This is located in a folder named agency at C:\Documents and Settings\Desktop\agency

Amended the windows host file at C:\WINDOWS\system32\drivers\etc\hosts

Already had 127.0.0.1 localhost

Now added 127.0.0.1 agency.localhost

Understand I need to set up virtual host for this but after 6 days still nothing, they don't work, or mainly stop Apache running. So beyond the point of thinking what I could be doing wrong, searched, read through here (which is useful) edited C:\xampp\xampplite\apache\conf\extra around 200 times, followed a number of posts on this here and others on the web (many seem wrong).

Can anyone please suggest any other method of running php on a windows machine, or point me towards docs on how you set a site up, or even tell me what is supposed to go into C:\xampp\xampplite\apache\conf\extra

Tried just about everything, from renaming, locating files in different paths, reversing slashes etc.

Thanks for your time, appreciate people should read and sort this type of thing out but run out of places to read.
bettlan
 
Posts: 4
Joined: 07. December 2010 02:27

Re: Virtual Host xampplite

Postby JonB » 08. December 2010 22:56

this is NOT a valid Windows path

C:\Documents and Settings\Desktop\agency


or 'shouldn't be' (let us be accurate) its missing the %user% element.

That may or may not be your issue - BUT its accurate.

Did you make whatever folder that 'spot' really is the DocumentRoot of the vhost??

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Virtual Host xampplite

Postby bettlan » 09. December 2010 03:19

Hi JonB

Thanks for taking the time to reply. You are right about the path, although that wasn't the issue, I did use the right one most of the time, just pasted here with a path example.

Eventually did get this working, even though I still don't know why many of the examples wouldn't work. I'm also aliasing the full domain locally, as I normally avoid relative links. Whilst my solution was minimal and did leave bits out (e.g. logs) will post this for anyone really stuck:

In C:\WINDOWS\system32\drivers\etc\hosts on a fresh line below 127.0.0.1 localhost added:

127.0.0.1 http://www.mydomain.com

In C:\xampp\xampplite\apache\conf\extra opened httpd-vhosts.conf and below commented section added:

NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:\xampp\xampplite\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\Documents and Settings\User\Desktop\foldername"
ServerName http://www.mydomain.com
<Directory "C:\Documents and Settings\User\Desktop\foldername">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

This also is fine using local subdomains e.g. folder.local instead of the domain and naturally functions without the www if that's your preference, I just have my links that way so no choice. No idea if this is a good solution but works and with a few on the web that don't, might help someone. In case anyone using this forgets, good to remove the reference from the windows host file when you put the site live, or you will still be seeing the test site.

Very grateful to all who helped with XAMPP, really useful. Still a bit to work out, testing email forms, issues with php includes in subfolders, which I solved but possibly not the best way. Will read up more on that and using XAMPP, which has helped iron out a few glitches on a site about to go up, a lot easier to do this on your own PC.
bettlan
 
Posts: 4
Joined: 07. December 2010 02:27

Re: Virtual Host xampplite

Postby bettlan » 09. December 2010 03:21

Please note that the domain name entries above should not include http:// which the forum system has added.
bettlan
 
Posts: 4
Joined: 07. December 2010 02:27

Re: Virtual Host xampplite

Postby JonB » 09. December 2010 03:40

I'm glad you got it working, and i would like to give you a suggestion - when you work with any cross-platform solution stick to paths that do not contain spaces or special characters. Its probably OK to start a DocumentRoot in one, but you are cruising for a bruising as many 'things' that started on *nix use Regex to parse file locations, and sometimes can't handle spaces.

http://www.december.com/unix/tutor/filenames.html

I usually make a folder in the root of a drive with 'sites' as its name, and the folder names are the dotted server names.

This can be very handy when you want to put your sites, but not the server on a thumb drive.

AND bettlan is right - the hosts file entries are in the form 'hostname.domainname.tld'

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Virtual Host xampplite

Postby bettlan » 09. December 2010 23:40

Thanks JonB

Good point about the spaces and I'll avoid that in future. Also just discovered your site, which looks helpful.
bettlan
 
Posts: 4
Joined: 07. December 2010 02:27


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 59 guests