Tutorials Point


  Learning PHP
  Advanced PHP
  PHP Function Reference
  PHP Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

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 Printer Friendly

Advertisements


  

Advertisements