CHDIR(3) 1 CHDIR(3)
chdir - Change directory
SYNOPSIS
bool chdir (string $directory)
DESCRIPTION
Changes PHP's current directory to $directory.
PARAMETERS
o $directory
- The new current directory
RETURN VALUES
Returns TRUE on success or FALSE on failure.
ERRORS
/EXCEPTIONS
Throws an error of level E_WARNING on failure.
EXAMPLES
Example #1
chdir(3) example
<?php
// current directory
echo getcwd() . "
";
chdir('public_html');
// current directory
echo getcwd() . "
";
?>
The above example will output something similar to:
/home/vincent
/home/vincent/public_html
NOTES
Note
When safe mode is enabled, PHP checks whether the directory in which the script is operating has the same UID (owner) as the script
that is being executed.
SEE ALSO
getcwd(3).
PHP Documentation Group CHDIR(3)