chroot()函数在php中返回“未定义的函数错误”

I am trying to change the path of a file (saved in /foo/bar directory) to the root

forexample

www.example.com/foo/bar/user.php 

to

www.example.com/user.php 

using chroot() function

<?php
chroot("/foo/bar/user.php");
$n=getcwd();
echo $n; 

it's not working, I am getting the following php error :

call to undefined function chroot() 

I am using php 5.3*, But I have also tested it on 5.4+ , still the same error. I am not sure if it is because of the the versions or something else,

Please help!

Note the following from the docs page:

This function is only available to GNU and BSD systems, and only when using the CLI, CGI or Embed SAPI. Also, this function requires root privileges.

Are you trying to use it on a Windows platform? If so this will not work.