PHP chroot()関数
例
ルートディレクトリを変更します。
<?php
// Change root directory
chroot("/path/to/chroot/");
// Get current directory
echo getcwd();
?>
結果:
/
定義と使用法
chroot()関数は、現在のプロセスのルートディレクトリを ディレクトリに変更し、現在の作業ディレクトリを「/」に変更します。
注:この関数にはroot権限が必要であり、GNUおよびBSDシステムでのみ使用でき、CLI、CGI、またはEmbedSAPIを使用している場合にのみ使用できます。
注:この機能は、Windowsプラットフォームには実装されていません。
構文
chroot(directory)
パラメータ値
Parameter | Description |
---|---|
directory | Required. Specifies the path to change the root directory to |
技術的な詳細
戻り値: | 成功するとTRUE。失敗するとFALSE。 |
---|---|
PHPバージョン: | 4.0.5+ |
❮PHPディレクトリリファレンス