Why PHP? Why not just use Apache mod_dav?