phpopen-basedir

openbase_dir warning says file is not in path, but then lists the path correctly


I am using MDB2 in an old php project, which I have just moved to a new server.

The project framework relies on some open_basedir config.

But there's something pretty odd.

I get the following error, which says a file /usr/share/pear/MDB2/Driver/mysql.php is not within allowed paths, but then lists the path to the file /usr/share/pear/MDB2/Driver in the list of allowed paths...

Why might this be?

PHP Warning:  is_readable(): open_basedir restriction in effect.
File(/usr/share/pear/MDB2/Driver/mysql.php) is not within the allowed path(s): 
(/var/some-paths:/usr/share/php:/usr/share/pear/MDB2/Driver) in /usr/share/php/MDB2.php on line 933

Solution

  • The solution was that the specific file itself didn't exist.

    The Pear optional features, like the specific DB types, have to be installed separately and this hadn't been done.

    The error message is in a way misleading. I guess technically it is correct, but it makes the error appear to be an issue with open_basedir config rather than a file not found.