use file_put_contents() function


See:http://bugs.modx.com/issues/3068