2

I have configured open_basedir in Apache virtual host in Linux which is working fine.

<Directory /var/www/abc/public_html>
     php_admin_value open_basedir "/var/www/abc/public_html"
</Directory>

I am required to allow a single symlink which is located outside the specified basedir (/var/www/abc/public_html/files --> ../files).

Is there anyway to do that?

jww
  • 97,681
  • 90
  • 411
  • 885
Saqib Iqbal
  • 339
  • 5
  • 13

1 Answers1

4

There is no way to bypass the open_basedir restriction, no. However, you could just include the additional symlink path to your open_basedir since it can accept more than just one path.

open_basedir=/var/www/abc/public_html:/var/www/abc/files

All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.

PHP Manual: open_basedir

What you have to keep in mind is that open_basedir allows everything in a given path. So that means once access is granted to the path /var/www/abc/files, everything in that path like /var/www/abc/files/foo, /var/www/abc/files/bar, etc... is also allowed.

Sherif
  • 11,786
  • 3
  • 32
  • 57