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.


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


/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


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");


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

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


require_once(dirname(__FILE__) . "/../config/config.php");
  • 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 – DemonWareXT Feb 2 '14 at 8:23
  • Ah, indeed. I edited the answer to add the slash. – Halfgaar Feb 2 '14 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.