How to symlink to a network drive with XAMPP, on Windows

10th April 2016 6:39 pm

Symlinks can be created on Windows using mklink. With the /D switch, this creates a directory symlink, and XAMPP has no problem following it and using the files in it.

But when symlinking to a network share rather than just another local folder, although it still works fine in Windows, XAMPP’s Apache can not see it at all.

The solution for this is two-fold, and isn’t actually to do with the symlink at all: Apache doesn’t like mapped network drives, and it can’t access network shares unless it’s running as a user that can.

So, to symlink a directory to a network share, and allow XAMPP to follow it:

  1. Run cmd as an Administrator (create a shortcut to cmd.exe on your desktop and right click it)
  2. Execute the command mklink /D C:\xampp\htdocs\full\path\to\the\new\folder \\NETWORK-SHARE-NAME-OR-IP\full\path\to\the\existing\folder
  3. Run services.msc (Start -> Run), and open Apache from the list of services
  4. Under the Log On tab, select Browse… and enter your system login (assuming it’s you that has access to the above network share of course!)
  5. Click OK, then stop and start Apache using the XAMPP Control panel

That should be it!

This post is also available on StackOverflow (if it helped you, feel free to upvote it!).