in reply to Creating a file in a CGI script...

The webserver probably doesn't have permission to write to the directory where you want to create the file. Try chmod 777 on the directory in question.