hi i'm trying to create some directories on my server via a script, and copy standard files into them. it all goes smoothly, but i cannot delete the files when i log into my webserver's FTP. i'm guessing wrong chmod code, but its so long since i used unix...
here is the code:
$h_name = "test"; copy("$SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL.php","$SERVER[DOCUMENT_ROOT]/photos/$h_name.php"); copy("$SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL_window.php","$SERVER[DOCUMENT_ROOT]/photos/{$h_name}_window.php"); mkdir("$_SERVER[DOCUMENT_ROOT]/photos/$h_name", 0777); copy("$_SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_index.html","$_SERVER[DOCUMENT_ROOT]/photos/$h_name/index.html");
$h_name = "test";
copy("$SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL.php","$SERVER[DOCUMENT_ROOT]/photos/$h_name.php"); copy("$SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_HOTEL_window.php","$SERVER[DOCUMENT_ROOT]/photos/{$h_name}_window.php");
mkdir("$_SERVER[DOCUMENT_ROOT]/photos/$h_name", 0777);
copy("$_SERVER[DOCUMENT_ROOT]/photos/EXAMPLE_index.html","$_SERVER[DOCUMENT_ROOT]/photos/$h_name/index.html");
Most likely those files are owned by whoever is running the web server and you don't have permission. Can you post the output of the 'ls' command from your FTP server while in the directory you're trying to get rid of the files in?
i own the server. it seems that php creates these directories then itself claims ownership of them.
i can't do an ls as i'm behind a firewall and can't login at the moment
Best place to fix it is in the script that copies the files. After copying the files run:
chown ($filename, $username)
You rather then PHP should then have ownership of the file