Hello, I have a dedicated linux server and I am trying to create a directory, then create another directory within and then write a file, the code works fine locally on xampp but does not work on the server. When running on the server it creates the first directory but thats it, I have no idea if it’s the code or the server that is the problem, help!
<?php $dir1 = "testdir1"; $dir2 = "images"; mkdir($dir1, 0777); chmod($dir1, 0777); //Open images directory $urldir = opendir($_POST['url']); mkdir($dir1."/".$dir2, 0777); chmod($dir1."/".$dir2, 0777); closedir($urldir); //Open images directory $urldir2 = opendir($dir1."/".$dir2); $thefile = $dir1."/".$dir2."/index.php"; $towrite = "<?php include '../index.php'; ?>";$openedfile = fopen($thefile, “w”);
fwrite($openedfile, $towrite);
fclose($openedfile);
closedir($urldir2);
?>$urldir2);