PHP - Function chroot()


Advertisements


Syntax

bool chroot ( string $directory )

Definition and Usage

It changes the root directory of the current process to the passed directory.

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

Parameters

Sr.No Parameter & Description
1

directory(Required)

The new root directory

Return Value

It returns TRUE on success or FALSE on failure.

Example

Following is the usage of this function −

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

php_function_reference.htm

Advertisements