This is a problem I have experienced with XAMPP on a windows installation. It arises when editing the httpd-vhost.conf to create a virtualhost. Using Virtualhost is one of the various ways to host multiple websites or services from a single IP address. It comes in use when you are either hosting multiple hosts from 1 IP(internet Protocol) or developing on a machine with multiple web projects.
After installing apache, the virtual hosts configuration file can be found at: “C:/apache/conf/extra”
The format of the httpd-vhosts.conf virtual host is as follows:
#remember to uncomment the below line NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin //insert your email here DocumentRoot "C:/xampp//your directory here" ServerName //name (what you will put in addressbar) SetEnv APPLICATION_ENV "development" ServerAlias //any alias eg. www.name #ErrorLog "logs/logname.log" #CustomLog "logs/logname.log" combined <Directory "C:/xampp//your directory here"> DirectoryIndex index.php AllowOverride All Order allow, deny Allow from All </Directory> </VirtualHost>
So that is the basic structure when adding a new virtual host to your apache web server.
Here comes the pain
You can now go ahead and restart apache. However you will be hit with this message. Apache will fail to start when you click start.
Error: Apache shutdown unexpectedly.
12:29:35 PM [Apache] This may be due to a blocked port, missing dependencies,
12:29:35 PM [Apache] improper privileges, a crash, or a shutdown by another method.
12:29:35 PM [Apache] Check the “/xampp/apache/logs/error.log” file
12:29:35 PM [Apache] and the Windows Event Viewer for more clues
Oh well what now?
A warm and easy solution…
Add the following to your httpd-vhosts.conf file, after or before the previous :
<VirtualHost *:80> DocumentRoot "C:\xampp\htdocs" #Or your default document root ServerName localhost </VirtualHost>
Now restart apache and it should work.
To be honest I’m not really sure why this happens, or what you can do if this does not work for you. If you have a better understanding do not hesitate to contact me or leave a comment.
You can read more on virtual hosting here: