English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP chroot() Function Usage and Example
PHP Directory Reference Manual
Syntax
Definition and Usage
It changes the root directory of the current process to the directory passed. --PHP needs to use-enable-chroot
Note: This function can only work correctly when the system supports and runs on CLI, CGI, or embedded SAPI version. In addition, this function also requires root privileges. On my machine, only root can use it.
Number | Parameters and Description |
---|---|
1 | directory(Required) New root directory |
Returns TRUE on success, FALSE on failure.
The following is the usage of this function, change the root directory:
<?php chroot('/server/var/www'); ?>