13

I did a fresh-install of XAMPP for Linux (version 1.7.4) on my Ubuntu 11.04 x64 laptop. Then I made a link in my htdocs folder to my project folder:

$pwd
/opt/lampp/htdocs
$sudo ln -s /home/petra/projects/webapp webapp
$ls -al
drwxr-xr-x  4 nobody root 4096 2011-08-18 11:58 .
drwxr-xr-x 18 root   root 4096 2011-01-25 15:33 ..
lrwxrwxrwx  1 root   root   26 2011-08-18 11:42 webapp -> /home/petra/projects/webapp

When I opened the webapp in the browser using http://localhost/webapp, it only showed "403 Access Forbidden". The error log said:

$tail -f /opt/lampp/logs/error_log
[Thu Aug 18 11:43:15 2011] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /opt/lampp/htdocs/webapp

Here is the httpd.conf. Strangely, the FollowSymLinks options are already defined (default).

There is a similar question on the XAMPP forum but I think nobody seems to pay attention to it anymore.

Does anyone have an idea how to fix this?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Petra Barus
  • 3,815
  • 8
  • 48
  • 87

3 Answers3

7

Try to run Apache using your user.

By default Apache runs as "www-data" so edit your apache2.conf, and search for "user" and set:

user=youruser

Restart Apache and voilà, it should work.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Nilson Morais
  • 821
  • 1
  • 7
  • 6
  • 13
    What a strange solution, I'd suggested the exact opposit : turn ownership of your files to apache. – ychaouche Nov 08 '12 at 16:45
  • 1
    @Petra Barus can you unflag this answer as the solution? This solution is not helpful, since the apache running as www-data is not a problem. – Mariano Argañaraz Nov 22 '13 at 18:30
5

I found out that if I use link from directory outside /home/petra, the web-app is working normally. I guess it's because I use Encrypted Home Directory setting on my Ubuntu.

I just have to move the project directory outside my home directory to make it work.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Petra Barus
  • 3,815
  • 8
  • 48
  • 87
  • Maybe it has something to do with a SELinux policy. If it's the case, you should see related warnings/errors in /var/log/messages – ychaouche Nov 08 '12 at 16:46
0

I ran into this problem when I symlinked the document root to code sitting on my encrypted home directory. I also solved it by running apache as the user who owned the encrypted content.

Victor
  • 349
  • 4
  • 7