Jump to: navigation, search

Php chroot

From w3cyberlearnings

Contents

PHP function chroot

This function changes to the root directory of specific directory.

Syntax chroot

dir is a directory

chroot(dir);

Return

Returns TRUE on success or FALSE on failure.

Example 1

<?php
  $path = dirname(__FILE__).'/mydir';
  chroot($path);
  echo getcwd();
?>

Output

/

--chdir-- chroot-- closedir-- dir-- getcwd-- opendir-- readdir-- rewinddir-- scandir--

Navigation
Web
SQL
MISC
References