Hi,

I installed XAMPP and confirmed that Apache and MySQL were working fine. Then I made a change to move the website files outside of the XAMPP program folder. My understanding is that the best way to do this is by setting a virtual host. I did the following:

• Stopped Apache and shut down XAMPP.
• Made a backup copy of “…\XAMPP\apache\conf\extra\httpd-vhosts.conf” and “C:\Windows\System32\drivers\etc\hosts”.
• In “…\XAMPP\apache\conf\extra\httpd-vhosts.conf”:
1. Removed the "## " at the beginning of the line, "## NameVirtualHost *:80"
2. Added the following lines at the end of the file:
>VirtualHost *:80>
DocumentRoot "C:/.../Web root/XAMPP/htdocs"
ServerName localhost
>Directory C:/.../Web root/XAMPP/htdocs>
Order allow,deny
Allow from all
>/Directory>
>/VirtualHost>
(I tried four different versions of the above: with versus without the quotation marks in the DocumentRoot setting and with forward versus backward slashes in both DocumentRoot and >Directory ...>. Same results all four ways.)
• In “C:\Windows\System32\drivers\etc\hosts”, added the line: "127.0.0.1 localhost", which is the only uncommented line in the file.
• Put a copy of “htdocs” in "C:/.../Web root/XAMPP".
• Renamed the original “htdocs” folder to “htdocs_bak” and added a shortcut in it to the new location (for documentation).
• Started up XAMPP.

MySQL started, but Apache did not. The XAMPP Control Panel log reported the following:

16:56:22 [main] Initializing Control Panel
16:56:22 [main] Windows Version: Windows 7 Professional SP1 64-bit
16:56:22 [main] XAMPP Version: 5.6.3
16:56:22 [main] Control Panel Version: 3.2.1 [ Compiled: May 7th 2013 ]
16:56:22 [main] Running with Administrator rights - good!
16:56:22 [main] XAMPP Installation Directory: "c:\[install root]\xampp\"
16:56:22 [main] Checking for prerequisites
16:56:22 [main] All prerequisites found
16:56:22 [main] Initializing Modules
16:56:22 [main] Enabling autostart for module "Apache"
16:56:22 [main] Enabling autostart for module "MySQL"
16:56:22 [main] Starting Check-Timer
16:56:22 [main] Control Panel Ready
16:56:23 [Apache] Autostart active: starting...
16:56:23 [Apache] Attempting to start Apache app...
16:56:23 [mysql] Autostart active: starting...
16:56:23 [mysql] Attempting to start MySQL app...
16:56:23 [mysql] Status change detected: running
(Nothing happened after that. MySQL was running, but Apache was not. I clicked "Start" for Apache.)
16:57:12 [Apache] Attempting to start Apache app...
16:57:12 [Apache] Status change detected: running
16:57:13 [Apache] Status change detected: stopped
16:57:13 [Apache] Error: Apache shutdown unexpectedly.
16:57:13 [Apache] This may be due to a blocked port, missing dependencies,
16:57:13 [Apache] improper privileges, a crash, or a shutdown by another method.
16:57:13 [Apache] Press the Logs button to view error logs and check
16:57:13 [Apache] the Windows Event Viewer for more clues
16:57:13 [Apache] If you need more help, copy and post this
16:57:13 [Apache] entire log window on the forums

I undid the changes described above and Apache started up okay. Then I made the changes again and got the same results shown above.

I checked the folder "C:\[install root]\xampp\apache\logs" and no file has a timestamp later than today at 16:50, so it can't be reporting anything about the above activity. I also checked Event Viewer. There is one error listed within the last hour and it is from the DNS Client, but it is timestamped 16:44, so it must also have been from an earlier problem that I fixed by changing to the procedure described above.

So I don't see any error data telling me why Apache failed to start.

Can anyone tell me what is wrong with the procedure described and why Apache is failing on startup?

Thanks for your help.

Comments

Jaypan’s picture

Maybe something else is running on the port Apache is supposed to run on.

NewSites’s picture

As I mentioned, when I undid the changes, Apache started up fine again. Then when I redid the changes, Apache again failed on startup. So it is the changes described that are causing the problem, not a port conflict.

NewSites’s picture

This problem has been solved in another forum. If anyone here is interested in the answer, you can see it at:
https://community.apachefriends.org/f/viewtopic.php?f=16&t=70548&p=24166...