downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

closedir> <chdir
[edit] Last updated: Fri, 10 Feb 2012

view this page in

chroot

(PHP 4 >= 4.0.5, PHP 5)

chroot改变根目录

说明

bool chroot ( string $directory )

将当前进程的根目录改变为 directory

本函数仅在系统支持且运行于 CLI,CGI 或嵌入 SAPI 版本时才能正确工作。此外本函数还需要 root 权限。

参数

directory

新目录

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.

注释

Note: 此函数未在 Windows 平台下实现。



add a note add a note User Contributed Notes chroot
nmmm at nmmm dot nu 20-Nov-2011 10:05
on my system this function is missing (Linux, php-cli), so I did:

if ( function_exists("chroot") ){
       chroot($chroot);
       server_log("chroot() to $chroot", 1);
}else{
       server_log("Can not chroot(). Will try live without it.");
}

 
show source | credits | stats | sitemap | contact | advertising | mirror sites