I then created a directory for '/mherrors' and set it to 666.
That presupposes the directory '/mherrors' at the root of the file system, which I assume is not correct. Haven't you rather created a directory in the document root of your user account? In that case you should state the *full* path the the directory.
Furthermore, assuming that you are on Unix or Linux, the file permission 666 for a directory is not sufficient to allow a CGI script to create files in it. Depending on the server configuration, you need at least 700, maybe 777.
Running the program now told me it could not open the '/mherrors/ERRORLOG.TXT' file. ("No such file or directory" was the error.)
That's because you hadn't stated the correct path. (If the path had been correct it would have complained about the permission instead.)
I then created a zero-byte file in /mherrors entitled ERRORLOG.TXT and set it to 666.
That's an unnecessary step.
HTH
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl