i have a cache folder called "static"
i cant figure out how to create a code to clear the contents of the folder
i have this right now
<?php
//stop cuirous people
if ($_SERVER['REQUEST_URI'])
die('You cannot access this file directly.');
function remove_directory($dir) {
if ($handle = opendir("$dir")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("$dir/$item")) {
remove_directory("$dir/$item");
} else {
unlink("$dir/$item");
}
}
}
closedir($handle);
rmdir($dir);
}
}
//remove static directory
remove_directory("/static");
//make static directory
mkdir("/static", 777);
print 'Job succesfully completed.'."\n";
print 'Static directory delted'."\n";
print 'Static directory created.'."\n";
?>
but i get this error
Warning: opendir(): open_basedir restriction in effect. File(/static) is not within the allowed path(s): (/home/dbhsusb/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/dbhsusb/public_html/clear_static.php on line 7
Warning: opendir(/static): failed to open dir: Operation not permitted in /home/dbhsusb/public_html/clear_static.php on line 7
Warning: mkdir(): open_basedir restriction in effect. File(/static) is not within the allowed path(s): (/home/dbhsusb/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/dbhsusb/public_html/clear_static.php on line 26
i was plannin on runnin this as a cron job