Women in Technology

Hear us Roar



Article:
  Apache Web-Serving with Mac OS X, Part 4
Subject:   Link to folder outside /Sites folder -- possible?
Date:   2002-02-27 23:45:30
From:   dredjohn
I've read through the series here -- very novice friendly. But I haven't found a way to do something that I perceive is very basic.


I've installed a php file manager so that I can let my friends and family browse through a pictures folder I have set up in my user directory.


For the sake of discussion, my website address is http://192.168.1.1/~marty/


On my harddrive this equates to /users/marty/Sites/


Pretty standard.


The pictures folder is located at:


/users/marty/Pictures/


I've tried creating a symbolic link:
ln -s ~/marty/Pictures ~/marty/Sites/pics


This makes "pics" a linked folder. I can cd to it in terminal, but if I go to my php filemanager it only sees the pics folder as a file. Clicking on it produces an error.


If I go directly to the url:
http://192.168.1.1/~marty/pics/


I get an error 403 about permissions.


I've tried editing marty.conf. It now reads:


<Directory "/Users/marty/Sites/">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>


I've also tried fiddling with settings in httpd.conf -- basically mimicking the settings above in areas I thought might make a difference.


Nothing helped.


But one that WAS interesting is despite all of these problems, I CAN link to any folder above the /Sites directory (i.e. /users/marty/Sites/temp/transfer)


In the above example, I can create a link of "transfer" in the Sites directory and access it with ease in the php filemanager AND through url access. Very strange...


I'd think it's quite common for website designers to link to folders on different harddrives or in directories outside of the Sites folder.


Maybe I'm wrong. Hopefully there is an easy answer to this, as I'd rather not have to duplicate all of my files - or move my pictures into the Sites directory.


Thanks in advance to any who have tips.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Morbus Iff photo Link to folder outside /Sites folder -- possible?
    2002-03-11 08:55:53  Morbus Iff | O'Reilly Author [View]

    What are the permissions of your Pictures directory? If you want to use symlinks, than the folders and files that you link to must have permissions that allow Apache to serve them. By default, the Pictures directory has "600" permissions, which only allow the user to read and write. If you want Apache to serve from that folder, you need to give it "755" permissions, which can be done with "chmod 755 /Users/marty/Pictures/". Using a similar configuration as yours, fixing the permissions was the clincher to get things working on my end.

    Your PHP program problem is a fact of life - some programs, either by fault of the language or the developer, don't understand symlinks, and will show them as a file, as you've been seeing. I'm not sure how PHP handles symlinks, but I'm sure you can Google a bit for the answer.