I am trying to do a really basic rename of a file to another name in my code. However there seems to be some ownership/permissions problem that is stopping this working correctly.

This is my (simplified) code:

PHP Code:
ini_set ("display_errors""1");
error_reporting(E_ALL);

$St_Num '7940';
$Co_Code 'RDCO2';

rename("$St_Num-$Co_Code-1.jpg""$St_Num-$Co_Code-4.jpg"); 
These are my permissions of the files I am trying to change:

Code:
-rw-r--r-- 1 apache dev   4065 Oct 22 17:57 7940-RDCO2-3.jpg
-rw-r--r-- 1 apache dev   4276 Oct 28 09:39 7940-RDCO2-2.jpg
-rw-r--r-- 1 apache dev   4336 Oct 28 09:39 7940-RDCO2-1.jpg
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?

I'm stumped with this one now - any help is appreciated.

Thanks,
Picco