Monday 26 August 2013

PHP Function chroot()

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');
?> 

No comments:

Post a Comment