3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // no separator $dir = '/tmp/'; ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } else print("Failed to open\n"); // with separator $dir = dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } else print("Failed to open\n"); // with separator $dir = '/tmp/'.PATH_SEPARATOR.dirname(PHP_BINARY); ini_set('open_basedir', $dir); print("ini_set to ".$dir."\n"); $fp = fopen('/tmp/hhvm-openbasedir-test', 'w'); if ($fp) { print("Opened!\n"); fclose($fb); } else print("Failed to open\n");
based on MNTuo
Output for 5.4.34 - 7.1.0
ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 10 ini_set to /usr/bin Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 21 ini_set to /tmp/:/usr/bin Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 31
Output for 5.4.0 - 5.4.32
Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 10 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 16 ini_set to /usr/bin Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 21 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 26 ini_set to /tmp/:/usr/bin Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 31
Output for 5.3.0 - 5.3.29
Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 10 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 15 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 25 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose() expects parameter 1 to be resource, null given in /in/7DmQe on line 31
Output for 5.0.4 - 5.2.17
Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 10 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 15 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 25 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 31
Output for 4.3.5 - 5.0.3
Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 10 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 15 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 25 Warning: ini_set() has been disabled for security reasons in /in/7DmQe on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 31
Output for 4.3.1 - 4.3.4
Warning: ini_set,pcntl_fork() has been disabled for security reasons in /in/7DmQe on line 5 ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 10 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 15 Warning: ini_set,pcntl_fork() has been disabled for security reasons in /in/7DmQe on line 16 ini_set to . Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 25 Warning: ini_set,pcntl_fork() has been disabled for security reasons in /in/7DmQe on line 26 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 31
Output for 4.3.0
ini_set to /tmp/ Opened! Notice: Undefined variable: fb in /in/7DmQe on line 10 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 10 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 15 ini_set to . Opened! Notice: Undefined variable: fb in /in/7DmQe on line 21 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 21 Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/7DmQe on line 25 ini_set to /tmp/:. Opened! Notice: Undefined variable: fb in /in/7DmQe on line 31 Warning: fclose(): supplied argument is not a valid stream resource in /in/7DmQe on line 31