PHP chroot

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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.