X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP chroot() Function

PHP Directory PHP Directory Reference

Example

Change the root directory:

<?php
// Change root directory
chroot("/path/to/chroot/");

// Get current directory
echo getcwd();
?>

Result:

/


Definition and Usage

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 to GNU and BSD systems, and only when using the CLI, CGI or Embed SAPI. This function is not implemented on Windows platforms.


Syntax

chroot(directory);

Parameter Description
directory Required. Specifies the path to change the root directory to

Technical Details

Return Value: TRUE on success. FALSE on failure.
PHP Version: 4.0.5+


PHP Directory PHP Directory Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook