All CGI scripts that are called from the web do not run with your account's permission by default. This is done for security reasons. The CGI scripts run as the user 'nobody', which is a fake username with no permissions. Because of this, any file or directory that you want a script to write to must be world writable (chmod 777 or chmod a+w).