Doesn't work š
Let me explain in more detail .....
I can use system() commands, but to do this I need to be able to have 777 permissions on a folder as Apache is run as a completely seperate user. This is obviously bad as people will be able to modify the contents of the folder.
In all (but one) cases I can use PHP commands like mrdir() and unlink() - that's fine, BUT they do not have permission to run either and they require the permissions to be 777, so I am no better off.
So I tried using chmod() before (and after) each command, that does not have permission to run.
So if I can't change permission in PHP I can't see a way around it. I don't want to have to set folders to 777!
My ISP (www.dataflame.co.uk) seems helpful, but in this instance can't do much.
Can anyone please think of a way around this, or something that I can email dataflame's support team and ask them to change.
This MUST be a common problem. Would there be any reason chmod() isn't working?
The error message given is:
Warning: chmod(): Operation not permitted in /home/username/public_html/test.php
One further thing that may give an indication of their setup. If I set folder permissions to 777, and create a folder in this one using PHP, this subfolder can then not be deleted by my FTP. I'm assuming this is because it is owned by Apache not me. I can of course delete the subfolder with PHP ... and change its permissions.
Now this made me think, perhaps I could chown() my folders to Apache, so I can have 777 permissions. This means I (and anyone else) could update files from PHP, but not from their usual account. Slightly safer, but still not good. Plus of course I will not be able to delete folders etc via FTP.
But I may be thinking on the right steps.
So ... I created a folder by PHP, then chmod() to 755. It worked (permissins had a T after them in FlashFXP (d-w-rwxr-T)- whatever that means) ... but now I can't delete this using PHP commands, system() commands within PHP or by FTP! I can't even use system() and chown to change ownership to my FTP account.
Now to make things slightly harder, as well as needing to read/write/delete/modify files/folders in seperate folders which I may be able to solve using some method. I also need to be able to create folders in my public_html folder so people can go to www.mysite.com/subsite/
I know this is a mess, but I am sure it's common, so can someone please help?
Cheers