If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

This code was working, and it seemed to work when apache was the *creator* of the file. However, when I changed the ownership to 'apache' it stopped working. Does PHP/Apache have a concept of knowing who the creator of a file was? Would this stop a rename() from working?

In most typical web host environments, PHP runs as an Apache module, and thus your scripts are executed under the Apache user. So if the file is owned by some other user, such as your personal login/FTP account, PHP functions such as rename() will only work on files created by another non-Apache user (e.g. you) if the file permissions include read and write for all users (666 or 777 in Linux/UNIX terms, or possibly 664 or 774 if the file owner and Apache share a user group).

So, if a file is created by your PHP script, then it is owned by the Apache user and can by default be rename()'d by it, but if created by your login user or other non-Apache user, then you need to give it the necessary permissions before your PHP script can modify it (assuming again that the script is being executed by Apache as is typically -- but not always -- the case).