mkdir does not create the directory

-1

Even though I have permission, it does not create the directory and returns "did not create."

<?php
$diretorio = 'C:/xampp/htdocs/LuckTor/arquivos/';
if (mkdir($diretorio . 'teste/', 777, true)) {
    echo 'criou';
} else {
    echo 'não criou';
}

echo 'q';
?>
    
asked by anonymous 19.02.2017 / 20:28

1 answer

0

Lucas,

The mkdir command has the following path, mode, and recursive parameters.

  • Question: The path C: / xampp / htdocs / LuckTor / files / exite?

If you are using Windows, the mode parameter is ignored, try the following:

mkdir ("C:/opt/xampp/htdocs/LuckTor/arquivos/teste");

If you are using Linux, try to do this:

$oldmask = umask(0);
mkdir ("/opt/xampp/htdocs/LuckTor/arquivos/teste", 0777, true);
umask ($oldmask);

The first line changes the umask to zero while storing the previous one in $ oldmask. The second line causes the directory to use the desired permissions. The third line restores the umask to what it was originally.

In this example it is imperative that the variable safe_mode is disabled. To change the safe_mode policy for a domain in the Linux Reseller, go to Plesk, click on the domain, go to "Configuration" and, on the line (PHP 'safe_mode' on), just uncheck the "ON" option.

More information:

link

link

link

    
19.02.2017 / 20:53