in reply to Problem with Cron job

I'd recommend changing that relative file path in the open() call to an absolute path -- the environment set up by cron is very sparse and it's quite likely not using the same directory to run from as the web server is, causing the relative path to put the file someplace other than where the script would put it if run under the web server as a CGI.