Re: How can I stop PHP from resolving symlinks?
| From: | Joel Leibow | Date: | Thu, 23 Feb 2006 22:59:55 +0000 |
| Subject: | Re: How can I stop PHP from resolving symlinks? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230988@lists.php.net to get a copy of this message | ||
You need to check your httpd.conf and make sure the "Options FollowSymLinks"
is set for the server. Check the apache documentation for further
information.
Joel Leibow
"Roy Souther" <roy@silicontao.com> wrote in message
news:1140654329.11677.44.camel@UtopiaPlanetia...
I am trying to stop PHP from resolving symlinks. I have a PHP CMS that I use
to host dozens of sites using Apache virtual hosting features. I need all
the sites to run the exact same PHP CMS code but use their unique
directories to host the different config files. The problem is that the PHP
scripts are running from the directory that the links point to and not the
directory where the site is. The big problem with that is the CMS tries to
read a configuration file that is in a relative location to the PHP script
like ../config.php.
root@ttyq0[~]# ls -l /usr/local/cms
-rw-r--r-- 1 user users 20 Jan 16 02:17 index.php
drwxr-xr-x 9 user users 4096 Feb 22 16:40 admin
root@ttyq0[~]# ls -l /vhost/test01.com/var/www/html/
-rw-r--r-- 1 user users 20 Jan 16 02:17 config.php
lrwxrwxrwx 1 root root 31 Feb 22 14:05 index.php ->
/usr/local/cms/index.php
lrwxrwxrwx 1 root root 31 Feb 22 14:05 admin ->
/usr/local/cms/admin
root@ttyq0[~]# cd /vhost/test01.com/var/www/html/admin/
root@ttyq0[admin]# pwd
/vhost/test01.com/var/www/html/admin
root@ttyq0[admin]#
Bash is doing what I need. It sees the current directory as the full path of
the symlink.
The admin.php at this point only has system("pwd"); in it and it prints out
/usr/local/cms/admin as the directory it is in, not what I want. It will
never see the ../config.php file.
I tried doing this
chdir ($_SERVER[DOCUMENT_ROOT]."/".$_SERVER[REQUEST_URI]);
but it still resolves the link and does not accept the path that I
constructed.
How can I make PHP use the symlink and stop trying to resolve the original
files?
Royce Souther
www.SiliconTao.com
Let Open Source help your business move beyond.
For security this message is digitally authenticated by GnuPG.