File is not within the allowed path

Written by
Date: 2012-04-27 16:28:00 00:00

If you get an error similar to this one, when executing PHP scripts.

File(/) is not within the allowed path(s):

Just edit the php.ini file and add the path where your php script is to the open_basedir setting.

So, if you have something like this:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/

And your scripts are in /etc/nginx/html change it to:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/etc/nginx/html/

Restart Apache or PHP-FPM and you should be done.