PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
However this is presenting a problem, this is created then the thing cant be deleted from the server over FTP. I look at the permissions on the server and they read 0755. Am I doin something wrong or what.
If you call mkdir() in PHP, that directory is being given the ownership of the apache user. If the permissions are set to 0755, then only the owner of that directory (which would be apache), can delete that folder. You need to either
give full rights to the group of that directory and make sure you're account is in that group,
give full rights to the world, or
change the ownership (chown is the linux command, not sure if there's a PHP equivalent) of the folder to you're account, after making the directory.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
It differs from host to host of course, but if they *have* disabled chown, check if they've disabled shell_exec() (they probably have) and you can call the linux chown yourself.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Instead of using mkdir you could use the ftp extension to login into localhost, and create it from there... This way the directory is owned by the ftp-user
<?php
$ftp_server = "ftp://myftp";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
$dir = 'www/users/andy';
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to create the directory $dir
if (ftp_mkdir($conn_id, $dir)) {
echo "successfully created $dir\n";
} else {
echo "There was a problem while creating $dir\n";
}
// close the connection
ftp_close($conn_id);
?>
What am I doin wrong, the ftp is right cos I accessed it, but it keeps throwin up stuff.