i want to ask some question.
I have a webserver (apache2/php/debian), and PHP configured with open_basedir option for some security reasons.
I need to acces to a url using file_get_contents(), but i get the error Warning: file_get_contents(): open_basedir restriction in effect.
I checked php config and allow_url_fopen is On.
In the development server (ubuntu 10.10) it works correctly, but in debian (6.0 squeeze) it doesn't. Any idea ??
PHP Version is 5.3.3-7+squeeze7 with Suhosin-Patch
An example:
php.ini:
Open_basedir = /var/securedir/:/var/www
allow_url_fopen = On
php code:
$a = file_get_contents("http://www.php.net");
Warning: file_get_contents(): open_basedir restriction in effect.
Another problem is that:
$b = file_get_contents("/var/securedir/file.xml")
Warning: file_get_contents(): open_basedir restriction in effect. File(/var/securedir/file.xml) is not within the allowed path(s): (/var/securedir/:/var/www)
`open_basedir = .:/var/securedir:/var/www $a = file_get_contents("http://www.php.net/");` – EsteveBlanch Feb 10 '12 at 11:43