Using SymLink in /opt/lampp/htdocs

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Using SymLink in /opt/lampp/htdocs

Postby fogmann » 28. February 2020 01:24

For a few reasons, I am wishing to symlink a directory in htdocs to my MAC filesystem.
I am using XAMPP-VM for Mac. I have recently upgraded to the VM version from the Mac App version.
I am trying to keep my source files in my local directory, and do not wish to move them into the VM. Therefore I am trying to symlink from the VM htdocs folder to my local files.

Using Terminal, I executed:
Code: Select all
 ln -s /srv/www/htdocs/mywebsite /opt/lampp/htdocs/mywebsite


The link installs fine and follows correctly. However Apache will not follow the link. It responds with:
Error 403 Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.


Permissions in /opt/lampp/htdocs/:
lrwxrwxrwx 1 1000 1000 29 27 Feb 15:30 mywebsite -> /srv/www/htdocs/mywebsite


Permissions in /srv/www/htdocs/:
drwxr-xr-x 41 User wheel 1312 27 Feb 15:21 mywebsite


I have tried changing ownership and permissions of the target and source to match. It seems the VM htdocs does not allow changing of the ownership, and the local file system htdocs does not recognize ownership of 1000.

FollowSymLinks is active in the httpd.conf

How can I link from the VM so Apache will follow the symlink into my local file structure?
fogmann
 
Posts: 2
Joined: 28. February 2020 01:02
XAMPP version: 7.4.2
Operating System: Mac High Sierra 10.13.6

Re: Using SymLink in /opt/lampp/htdocs

Postby Nobbie » 28. February 2020 13:56

fogmann wrote:Using Terminal, I executed:
Code: Select all
 ln -s /srv/www/htdocs/mywebsite /opt/lampp/htdocs/mywebsite



That does not work. You have now created a symbolic link inside the VM (which has its own filesystem). The file /srv/www/htdocs/mywebsite inside the VM is NOT the same file as in your OS filesystem /srv/www/htdocs/mywebsite. It only has the the same name, but a different location.

You cannot put a symbolic link from inside the VM to the Host System (your OS). You have to declare netware shares for that, but as i dont know which VM is used from Bitnami for the Xampp VM installation, i cannot tell how to do that.

I strongly recommend NOT to use the VM versions, instead download and install the normal Xampp version, which installs to the host system into /Applications/Xampp/.... etc. Then you finally can put a symbolic link from the htdocs folder to your home folder or whereever you want.

fogmann wrote:How can I link from the VM so Apache will follow the symlink into my local file structure?


You cannot.
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04

Re: Using SymLink in /opt/lampp/htdocs

Postby fogmann » 28. February 2020 20:42

Ahh, yes! Of course, that makes sense. Thanks for pointing this out.
I have used some VirtualBox VM's in the past, but this XAMPP VM setup is a bit more stealth, confusing me into thinking it was on my filesystem.
fogmann
 
Posts: 2
Joined: 28. February 2020 01:02
XAMPP version: 7.4.2
Operating System: Mac High Sierra 10.13.6


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 8 guests