symlinks with apache php, is there an alternative
Hi,
what i want is to point 4 subdirectories in 4 cms's to one physical directory with all images. I tried using symlinks but the cms will not work with that. Does someone have an idea on how to solve this? regards, Jan |
Quote:
Are you sure that it's the CMS that doesn't work? It could be the apache configuration. apache symlink usage can be tricky. For example, I've discovered that setting FollowSymLinks for a directory does not propagate to sub-directories. (I was ready to throw a 'puter out the window before I figured that out) |
Quote:
Quote:
|
Thanks for the replies,
cms means content management system, cms made simple a PHP cms. I have put "Options +FollowSymLinks" and "Options + Indexes" in the htaccess. Now I do not get an error on the "pwd" anymore that cannot be set, but I jump back to the root-directory of the cms. I am testing this on a local machine and with bash I can run ls on the symlink, it shows all the files in the directory that I put the symlink on. So it is an apache/php/cmsms problem I guess. Regards, Jan |
Hi,
I used mount --bind and with only one subdirectory that works. Just what I want is to have a bunch of files (images) in ONE subdirectory and link this directory to 4 different subdirectories from 4 CMSses so these 4 CMSses can use the same pool of images. I looked at "mount --make-shared mountpoint" but it seems to work the other way around. I consider using rsync and have copies of the images in all subdirectories, but hope there is a way to avoid that. regards, Jan |
Quote:
What do you mean by "jump back to the root-directory..." How are you defining the symlinks? Show us the relevant section of your config/htaccess. Show us the section of the php that's using the linked directory. Once the symlink is set up, and +FollowSymLinks is set for the directory where the symlink is, the browser should just treat it like a real directory. |
Thanks for the reply,
pwd - working directory, I got an error because the filemaneger inside CMSMS could not set the pwd (working directory) pwd - print name of current/working directory (bash) "jump back to the root-directory..." I made a symlink to another directory outside the directory-tree for the CMS ln -s /var/www/ap ap The CMS stores images in "[rootdir]/uploads/images" I made a subdirectory ap "..../uploads/images/ap" to which the symlink points. On the commandline I can use "ls" and I get what I expected. When I used the filemanager from the CMS and clicked the symlinked directory "ap", I jump to the "rootdirectory" of the CMS defined the symlink from directory /uploads/images sudo -u www-data ln -s /var/www/ap ap .htaccess just 2 lines because I test it on localhost Options +FollowSymLinks Options +Indexes The PHP-Code of Filemanager of the CMS made with Smarty I will have to ask where to find it, I am not the programmer. regards, Jan |
Try to narrow it down - is apache causing this to not work, or something inside all 4 CMS's (the latter seems unlikely)?
Do some testing without any CMS first - does the server serve symlinked directories at all? And show us. Output, commands, logs... |
Hi ondoho
the CMS is CMS Made Simple. I am testing local - the filemanager is the same. So if CMSMS cannot handle symlinks it will not work for all of them. The idea to test without CMSMS is good, I will do that now. Be right back again. regards, Jan |
Quote:
Also CMSMS is only one - of four? |
Quote:
|
OK
the symlink will not work without CMSMS either, Thanks ehartman, I am trying this all within 1 Apache-install, all below var/www, linked is to a subdirectory 2 levels below the sites root. I will do this again on a test-install on the server where it should come because if it works there then the problem is solved. regards, Jan |
I'm going to ask this again, because you didn't answer specifically.
Is the +FollowSymLinks for the directory where the link is? That is: Code:
<Directory /var/www/> Code:
lrwxrwxrwx. 1 someuser somegrp 27 Apr 29 12:04 /var/www/ap -> /path/to/otherdir/ PS Options can be specified on one line... Code:
Options +FollowSymLinks +Indexes |
Quote:
Code:
# DocumentRoot: The directory out of which you will serve your So, a working symbolic link can point outside the DocumentRoot (apache "chroot") tree, but of course the symbolic link itself must be within the DocumentRoot tree. (unless Aliased...but let's not go there today) :) |
Quote:
So if the directory you want to link TO is /var/www/htdocs/some/dir and the link should be in the directory /var/www/htdocs/somewhere/else create the link by using Code:
cd /var/www/htdocs/somewhere/else |
All times are GMT -5. The time now is 01:01 AM. |