I am trying to use PHP command to create a folder in the same folder as the command-file is run.
This worked when the PHP command script was located in public_html aka top level directory.
However when locating this working code into a sub-directory, it is giving an error on this part of the code: 0777
This number is a file permission. Does mean it doesn’t have permission to write to sub-folders?
Warning: mkdir(): No such file or directory in /storage/h10/365/1360365/public_html/LR/CreateSubfolder.php on line 11
Failed to create directory…
Actual code that runs, but only in the top level directory:
<<?php
$thisdir = getcwd();
$new_dir = ‘145’;
if(
mkdir(
$thisdir .
“LR/upload/” .
$new_dir,
0777))
// creates a subfolder called “upload” and a new file called “145”
{
echo “Directory has been created successfully…”;
}
else
{
echo “Failed to create directory…”;
}
?>