Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if open_basedir restriction is in effect

I'm getting the following warning when using PHPass (http://www.openwall.com/phpass/):

open_basedir restriction in effect. File(/dev/urandom) is not within the allowed path(s)

Although this is not a big problem (it will fall back on something else), I'd like not to have this warning. The PHP application should run on different servers, some users will be able to add that path to their allowed open_basedir paths, but others won't have access to that configuration.

My first guess was to check readability with is_readable(), however, I'm still getting the warning.

The question: How do I check if a certain path or file has been added to the open_basedir paths?

like image 869
T.S. Avatar asked Jan 29 '14 09:01

T.S.


1 Answers

You can read the value of PHP directives with the ini_get() function:

ini_get('open_basedir')

If the directive's not empty, it should contain a string with one ore more paths separated by PATH_SEPARATOR.

like image 139
Álvaro González Avatar answered Oct 14 '22 01:10

Álvaro González