Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP chroot() Function

PHP chroot() Function

PHP Directory PHP Directory Reference Manual

Example

Change the root directory:

Result:

/


Definition and Usage

The chroot() function changes the root directory of the current process to directory, and changes the current working directory to "/".

**Note:** This function requires root privileges and is only available on GNU and BSD systems when using the CLI, CGI, or embedded SAPI. It is not implemented on Windows platforms.


Syntax

chroot(

directory

);

Parameters Description
directory Required. Specifies the path of the new root directory.

Technical Details

Return Value: Returns TRUE on success, or FALSE on failure.
PHP Version: 4.0.5+

PHP Directory PHP Directory Reference Manual