What is the common error message encountered when trying to create a directory using mkdir() in PHP on Windows?

When trying to create a directory using mkdir() in PHP on Windows, a common error message that may be encountered is "Permission denied". This error occurs when the PHP script does not have the necessary permissions to create a directory in the specified location. To solve this issue, you can explicitly set the permissions of the directory using the optional parameter in the mkdir() function.

$dir = 'path/to/new/directory';
$permissions = 0777; // Set the permissions for the directory

if (!is_dir($dir)) {
    mkdir($dir, $permissions, true);
}