Jabda
Jabda

Reputation: 1792

php opendir symbolic link on localhost apache

I am running a localhost server on my mac under /Users/myusername/Sites

I have a symbolic link in my Sites folder to an external dropbox directory . If I try to run opendir and load images in the directory that is a symbolic link I get

Warning: opendir(dir/symlinkDir/) [function.opendir]: failed to open dir: Permission denied 

symlinkDir is a symbolic link to a dir containing images. This works fine it symlinkDir is not a soft link but instead an actual dir.

I have tried changing permissions on the directory, 755, 777, +x. I've also tried changing the /etc/apache2/users/myusername.conf to

<Directory "/Users/myusername/Sites/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Upvotes: 0

Views: 2178

Answers (2)

Jabda
Jabda

Reputation: 1792

I found the solution here. Although I did try all the steps mentioned, I retired in the order listed and it worked

http://gutsup.tumblr.com/post/18368141819/getting-apache-to-host-dropbox-files-on-a-mac

Upvotes: 0

Yarik Dot
Yarik Dot

Reputation: 1113

There will be issue with user permissions. I mean - webserver is running under different user then files are owned by.

If you do (change YOUR_DIRECTORY to directory with images), all users are supposed to see files:

find YOUR_DIRECTORY -type d -exec chmod 775 {} \;
find YOUR_DIRECTORY -type f -exec chmod 664 {} \;

Please check, that parent directories are accessible by webserver user. You can test is by changing under webserver user (usualy www-data):

su -l www-data -s /bin/bash

Upvotes: 1

Related Questions