Change root directory:
<?php// Change root directorychroot("/path/to/chroot/");// Get current directoryecho getcwd();?>result:
/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 CLI, CGI, and embedded SAPI. This function is not implemented on the Windows platform.
chroot( directory );
parameter | describe |
---|---|
directory | Required. Specifies the new root directory path. |
Return value: | Returns TRUE on success and FALSE on failure. |
---|---|
PHP version: | 4.0.5+ |