Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I symlink to a network drive with XAMPP in Windows?

I can use mklink /D to create a directory symlink on Windows, and XAMPP has no problem following it and using the files in it.

But when I'm 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.

Is there any way around this, or is it impossible to symlink a network share with XAMPP?

(XAMPP's httpd.conf (in C:\xampp\apache\httpd.conf) has Options FollowSymLinks turned on by default - and it's working, as evidenced by the local folder example)

Edit: this is on XAMPP 3.2.1 on Windows 10 Pro

like image 996
Tim Malone Avatar asked Apr 08 '16 01:04

Tim Malone


1 Answers

I hunted around here on SO first for an answer, as well as on ServerFault. Eventually by putting together a few answers from across the web I was able to solve this.

The solution 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 anyway unless it's running as a user that can.

So, the full instructions for symlinking a directory to a network share with XAMPP are as follows:

  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!

like image 194
Tim Malone Avatar answered Oct 15 '22 12:10

Tim Malone