Skip to content
Advertisement

PHP: Can’t Set Open_basedir

I try to execute:

var_dump(ini_set("open_basedir",ini_get("open_basedir")));

with PHP and get false.

Apache 2. PHP Version: 5.3.28, it should change it from script, how i read at php.net documentation.

Currently open_basedir is .:/data/www/vhosts/hostname:/tmp

I try to do it at local server with same OS, Apache and PHP and all ok. I try to set already setted value because i try to debug why i can’t put any value there. Help, please !

Advertisement

Answer

Typically open_basedir is no value in php 5. (hence it may return false — if you are setting it by getting the current value and use var_dump for display).

I suggest you to use the following to see what actual value is the open_basedir in your system:

<?php
phpinfo();
?>

To further test, please try this code:

  1. use ini_set to set the value;
  2. return it;
<?php
//var_dump(ini_set("open_basedir",ini_get("open_basedir")));

ini_set("open_basedir", ".hello");
echo "The open_basedir value is :". ini_get('open_basedir');
?>
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement