w3resource

PHP: chroot() function

Description

The chroot() function is used to change the root directory of the current process to the specified directory.
This function is only available if your system supports it and you're using the CLI, CGI or Embed SAPI. Also, this function requires root privileges.

Version:

(PHP 4 and above)

Syntax:

chroot(directory_name)

Parameter:

Name Description Required /
Optional
Type
directory_name The new directory. Required String

Return value:

TRUE on success and FALSE on failure.

Value Type: Boolean.

See also

PHP Function Reference

Previous: chdir
Next: dir



Follow us on Facebook and Twitter for latest update.