September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool chown(string file, mixed user)
Changes the ownership of a file.
Returns:
TRUE on success; FALSE on error
Description:
chown() changes the ownership of the specified file. Since this function on nearly all UNIX systems is restricted to being run by the superuser, it won’t operate correctly when PHP is run as a module (unless you run httpd as root). This function always returns TRUE on Win32 platforms.
Note:
If safe mode is enabled, chown() can only change the ownership of files that are owned by the user running the command. In most cases, this is the user that the web server runs as.
Example:
$file = "test_file";
if (! chown ($file, "user")) {
echo ("Unable to change file ownership");
}
|
Read now
Unlock full access