Click to See Complete Forum and Search --> : apache and symlinks


nephish
05-30-2006, 03:46 PM
ello there all,

i am hosting three very similar websites and i wanted to share some php scripts between them.
so i put some in /usr/share/php/
and put symlinks to them, but the server will not show the page.

is there something i need to fix or change in the apache http.conf?
and if so, is it a security hazzard to use symlinks ?

thanks

Icarus
05-30-2006, 04:31 PM
yes, php will not parse links at all. This is to keep someone from doing 'bad things' to the system. I think there might be a way to enable them in the php.ini but I would highly suggest not to do so

nephish
05-30-2006, 04:39 PM
ok, good enough
i will find another way

teeitup
05-31-2006, 01:06 AM
Why not try linking the directory instead?

nephish
05-31-2006, 01:17 AM
is that the same security risk?
thanks by the way

Icarus
05-31-2006, 09:19 AM
Same thing, links are completly ignored by php

soulestream
05-31-2006, 06:01 PM
could you use mount --bind and just mount the same folder three times


ie put everything in /whatever/phpscripts

then mount /whatever/phpscripts /websiteone/php, mount /whatever/phpscripts /websitetwo/php, etc


Soule

bwkaz
05-31-2006, 08:14 PM
mount --bind is basically "hard links for directories" -- I would think it'd be simpler to hard-link the files. (Though it depends on the number of files, and whether you want new ones to automatically show up in both places, I guess.)

To create a hardlink, instead of "ln -s targetfile sourcelinkname", use just "ln existingfile newfilename".

Note that after you do this, you will have to "rm" all of the filenames that got hardlinked together before the file will be deleted from the disk. (Using ln to create a hardlink basically just creates a new name for the same file blocks. There is no such thing as a "source" and "destination" like there is with symlinks; both filenames are completely equivalent.)

nephish
06-01-2006, 01:32 PM
well, it looks like that is working.
i did a mount --bind to the directory holding the files that i wanted to share, and it worked.
now, can i put something in fstab so it will not go away if i reboot?

thanks

soulestream
06-01-2006, 04:52 PM
I dont think I could ever get an fstab working. So I just made a script at startup.


Soule

nephish
06-01-2006, 06:01 PM
is that the recommended way to go?
where do i put the script ?
thanks