Change the root directory for the current process.
| <?php // Change root directory chroot(“/path/to/chroot/”); // Get current directory echo getcwd(); ?> |
Result:
| / |
The chroot() function changes the root directory of the current process to the specified directory and sets the current working directory to “/”.
Note: This function requires root privileges and is available only on GNU and BSD systems, and only when using CLI, CGI, or Embed SAPI.
Note: This function is not implemented on Windows platforms.
| chroot(directory) |
|
Parameter |
Description |
|
directory |
Required. Specifies the path to change the root directory to |
|
Return Value: |
Returns TRUE on success and FALSE on failure. |
|
PHP Version: |
4.0.5+ |