chroot in PHP

Syntax of chroot in PHP

bool chroot(string path)

Changes the root directory of the current process to path. You cannot use chroot() to restore the root directory to / when running PHP in a web server environment. Returns true if the change was successful and false if not.

Example of chroot

echo getcwd();


Leave a Comment