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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/chroot.php