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!
I need to copy a file (using the copy function) from one directory to another, but I will need write access to "other" user in order to do so.
All I need is to give write access to the directory, copy the file and then remove it again.
only the owner and root have the permission to change file permissions (what would be the purpose of such a mechanism otherwise )
if unsure under which effective user id your script is running try
It is not so much the owner of the PHP page, but the user that is running the PHP page, so the webserver may not be running as the user that owns the files.
You may need to get shell access to the command line on the server to change permissions, or maybe some ftp clients can change permissions.
Yes on the command line I can change the permission, but I wanted to change it using php. I am developing a web interface to be used by one or two users here to upload their html files to their ftp directory on unix. This is not just an alternative to a ftp client, but also these html pages need to be edited programmatically, adding an include file at the top and renaming from .htm to .php. Everything was working fine when the directory had write access to "other" users (757), but when I removed write access (755) using the command-line and tried to do it in php, it gave permission errors.
The transfer and editing takes place from the /var/tmp/ directory to the actual ftp directory (bizarre I know...). This results in yet another problem: The owner of the uploaded file is now "http", which means the file cannot be overwritten in future by the user using his normal ftp client.