chroot函数使用_PHP chroot()函数与示例
chroot函數使用
PHP chroot()函數 (PHP chroot() function)
The full form of chroot is "Change Root", the function chroot()" is used to change the root directory, and, also changes the current working directory to "/".
chroot的完整格式為“ Change Root” , 函數chroot()“用于更改根目錄,并且還將當前工作目錄更改為” /“ 。
Syntax:
句法:
chroot(directory);Parameter(s):
參數:
directory – It defines the new root directory.
directory –它定義了新的根目錄。
Return value:
返回值:
It returns a Boolean value, "TRUE" – if root directory changes successfully or "FALSE" – if root directory does not change.
如果根目錄成功更改,則返回布爾值“ TRUE”;如果根目錄未更改,則返回“ FALSE”。
Note:
注意:
chroot() will not work on Windows PHP installations. As per the reference manual, the function is only available on PHP when using in CLI/CGI/Embedded SAPI.
chroot()在Windows PHP安裝中不起作用。 根據參考手冊,僅在CLI / CGI / Embedded SAPI中使用時,該功能僅在PHP上可用。
The chroot() function requires root privileges. Please refer to the official php.net manual before attempting this function PHP chroot() function
chroot()函數需要root特權。 嘗試使用此函數之前,請參考php.net官方手冊PHP chroot()函數
We are not responsible in any way of any damage this function may cause.
對于此功能可能造成的任何損害,我們概不負責。
The following is a sample output of the program,
以下是程序的示例輸出,
When Success:/root directory is changed.../home/folder1When fail:/root directory is not changed...Example: PHP code to change the root director
示例:更改root導演PHP代碼
<?php echo getcwd();//making a directory mkdir("/home/folder1");// Change root directory $ret_value = chroot("/home/folder1");if($ret_value == true)echo "root directory is changed..."; else echo "root directory is not changed...";// Get current directory echo getcwd(); ?>Output
輸出量
root directory is changed... /home/folder1Reference: PHP chroot() function
參考: PHP chroot()函數
翻譯自: https://www.includehelp.com/php/chroot-function-with-example.aspx
chroot函數使用
總結
以上是生活随笔為你收集整理的chroot函数使用_PHP chroot()函数与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mongo数据库插入数据_深入研究Mon
- 下一篇: Java中从String到Long的转换