Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
To be clear, does cms mean Content Management System? If not, what does it mean?
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)
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.
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.
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
What do you mean by 'on the "pwd"'? How are you running pwd inside your php code?
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.
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.
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?
So if CMSMS cannot handle symlinks it will not work for all of them.
Check too if the file or directory linked TO is within the apache "chroot" tree (often /var/www/htdocs) as apache cannot see ANY directories above it (or otherwise not below that directory).
Check too if the file or directory linked TO is within the apache "chroot" tree (often /var/www/htdocs) as apache cannot see ANY directories above it (or otherwise not below that directory).
I note this in httpd.conf:
Code:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
(emphasis added)
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)
nks 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.
Another observation: I do not know how strong the "chroot" in Apache is (never used this myself), but you might try to use relative, not absolute, paths for the links as "/" may not be the same for Apache as for the whole filesystem.
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
ln -s ../../some/dir <name of the link>
so that you never have a pathname with "/" as the starting directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.