0

We have the following setup:

  • /var/www/public <-- DocumentRoot
  • /var/www/functions <-- php Functions
  • /var/www/config <-- php configurations

Via apache vhost configuration we open the basedir:

php_admin_value open_basedir "/var/www/functions/:/var/www/config/"

Now if I include a document under functions or config from public, that works as expected. But if I include a config from within functions that does not.

so:

/var/www/public/index.php can include ../functions/test.php

but

/var/www/functions/test.php can't include ../config/config.php

open_basedir restriction in effect. File(../config/config.php) is not within the allowed path(s): (/var/www/functions/:/var/www/config/) in /var/www/functions/test.php on line 1067

Any thoughts on this maybe?

Thanks and kind regards

Linus

Additional Info:

If I include with full path it works, as in include_once("/var/www/config/config.php"); instead of include_once("../config/config.php");

1 Answer 1

1

It's something you're writing yourself? Typical PHP use in that case would be:

require_once(dirname(__FILE__) . "/bla/foo.php");

or

require_once(dirname(__FILE__) . "/../config/config.php");
2
  • It's for me and a friend, I am not too much of a PHP artist. I just play around with the server config. and thanks a lot for your answer, however, just for general information, it's require_once(dirname(FILE) . "/../config/config.php"); you where missing one slash ;) cheers! Linus Feb 2, 2014 at 8:23
  • Ah, indeed. I edited the answer to add the slash.
    – Halfgaar
    Feb 2, 2014 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .