Copyright © tutorialspoint.com

PHP Function chroot()

previous
Advertisements

Syntax

bool chroot ( string $directory )

Definition and Usage

Changes the root directory of the current process to the passed 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.

PHP needs to be configured with --enable-chroot-func and on my machine only root can use it.

Paramters

ParameterDescription
directoryRequired. The new root directory

Return Value

Returns TRUE on success or FALSE on failure.

Example

Following is the usage of this function:

<?php
chroot('/var/www');
?> 
previous

Copyright © tutorialspoint.com