i try creat folder using php script as well in pvs server that system ubuntu

Viewed 28
<?php
$type="student";
$paths="klm";
$a2="med";
$da="_";
$a23=$type.$da.$paths.$da.$a2;
$enpath=$type.'//'.$a23;
  

$folder_name=$enpath;
   if (!file_exists($output_dir . $folder_name))
            {
                @mkdir($output_dir . $folder_name, 0777,true); 
                echo "Folder Created";
            }
   

?>

xhello dev linux please fix my problem im using script php in server vps trying to creat folders look like this screen but when i search about those folders i cant find it the file.php in folder that this path: home/public/file.php and also in this path there student folder : home/public/student so i need to make child folder in student folder

1 Answers

Your code is a bit tricky but looks like $output_dir is undefined so is null due to PHP default behavior. So you're trying to create student/student_klm_med dir, not a /home/public/student/student_klm_med or whatever. Note that mkdir() requires an absolute system path to create a directory.

Related