views:

68

answers:

2

Hi, I'm new to using XAMPP so this may be simple to some people.

I have a few php projects that I would like to be able to debug locally and view in the browser (not concurrently, but without having to change config files/copy project folders each time I want to work on a different project).

On IIS, you could set up multiple sites to serve from your machine, and I'm looking for something similar in XAMPP. When using IIS, I added multiple records to the Windows hosts file so I could access the locally hosted sites by typing friendly web-style addresses (like http://myproject1.dev)

Thanks.

+5  A: 

You need to look into setting up virtual hosts. Here are some good starter resources.

Ailoo.net

Linux.com

Moses
+1 for a great answer.
Brad F Jacobs
thanks, the first link was exactly what I was looking for.
Greg
A: 

Greg, you're almost there--you need (like Moses said) to setup virtual hosts.

So if your Windows hosts file has

127.0.0.1    localhost
127.0.0.1    mysite-dev.com
127.0.0.1    anothersite-dev.com

Your virtual hosts file (httpd-vhosts.conf) might look like:

<VirtualHost *:80>
  DocumentRoot C:/xampp/htdocs/
  ServerName localhost
</VirtualHost>

<VirtualHost *:80>

    ServerName mysite-dev.com

    DocumentRoot "C:/sites/mysite-dev"

    <Directory "C:/sites/mysite-dev">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost *:80>

    ServerName anothersite-dev.com

    DocumentRoot "C:/sites/anothersite-dev"

    <Directory "C:/sites/anothersite-dev">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

Don't forget to restart the web server after you make any changes.

jnunn