If you want to rename a file in PHP you can use the rename function. The syntax of the rename function is same as that of the UNIX mv(move) command. The general syntax is:

rename('/pathA/old_file_name', '/pathB/new_file_name');

e.g.

rename('/tmp/data.log', '/tmp/data1.log');