chroot

Change the root directory

Syntax

chroot(string $directory): bool

Parameters

directory

The path to change the root directory to.

Return

Returns true on success or false on failure.

Examples

1 · Return

<?

$directory = "/path/to/root/";

$return = chroot($directory);

var_export($return);

?>
true

2 · getcwd

<?

$directory = "/path/to/root/";

chroot($directory);

echo getcwd();

?>
/

chdir

closedir

dir

getcwd

opendir

readdir

rewinddir

scandir

PHP

Home Menu