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

search for in the

closedir> <chdir
[edit] Last updated: Fri, 17 May 2013

view this page in

chroot

(PHP 4 >= 4.0.5, PHP 5)

chrootルートディレクトリを変更する

説明

bool chroot ( string $directory )

カレントプロセスのルートディレクトリを directory に変更し、 作業ディレクトリを "/" に変更します。

この関数が使えるのは GNU および BSD システムのみで、 かつ CLI, CGI, Embed SAPI を使用している場合のみです。

パラメータ

directory

ルートディレクトリの変更先のパス。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 chroot() の例

<?php
chroot
("/path/to/your/chroot/");
echo 
getcwd();
?>

上の例の出力は以下となります。

/

注意

注意: この関数は Windows 環境にはまだ実装されていません。



add a note add a note User Contributed Notes chroot - [1 notes]
up
-1
nmmm at nmmm dot nu
1 year ago
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