# "An error occurred while writing CGI reply" with fcgiwrap

**URL:** <https://www.ruby-forum.com/t/an-error-occurred-while-writing-cgi-reply-with-fcgiwrap/170534>\
**Category:** NGINX\
**Created:** [June 18, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/an-error-occurred-while-writing-cgi-reply-with-fcgiwrap/170534 "2009-06-18T16:24:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![taha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@taha](https://www.ruby-forum.com/u/taha)\
**Post date:** [June 18, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/an-error-occurred-while-writing-cgi-reply-with-fcgiwrap/170534/1 "2009-06-18T16:24:42Z")

</div>

Hi,

I am using fcgiwrap from [http://nginx.localdomain.pl/wiki/FcgiWrap](http://nginx.localdomain.pl/wiki/FcgiWrap) to  
run Perl scripts with Nginx (0.6.35) and first it functioned just fine  
but then suddenly it stopped working with one application (Movable Type)  
and only returns message “An error occurred while writing CGI reply”. I  
tested some other simple Perl scripts and with those it still works fine  
and returns the normal content. I also tested executing the problematic  
scripts from command line and from there those still worked normally.

Nginx access log is showing 502 errors for the requests which produce  
the mentioned error message. Nothing in error log.

Here is CGI part of the site Nginx configuration:

location ~ ^/cgi-bin/.\*.cgi$ {  
gzip off;  
fastcgi\_pass unix:/path/to/cgi.sock;  
fastcgi\_param SCRIPT\_FILENAME  
/path/to/www.domain.tld$fastcgi\_script\_name;  
fastcgi\_param SCRIPT\_NAME $fastcgi\_script\_name;  
fastcgi\_param DOCUMENT\_ROOT /path/to/www.domain.tld/;  
include /path/to/fastcgi\_params;  
}

Any ideas what could be causing this?

Thanks.

Posted at Nginx Forum:

> **["An error occurred while writing CGI reply" with fcgiwrap](https://forum.nginx.org/read.php?2,3068,3068#msg-3068)**
>
> Hi, I am using fcgiwrap from http://nginx.localdomain.pl/wiki/FcgiWrap to run Perl scripts with Nginx (0.6.35) and first it functioned just fine but then suddenly it stopped working with one application (Movable Type) and only returns message...

---

<div class="post-metadata">

**Author:** ![taha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ea5d25/32.png) [@taha](https://www.ruby-forum.com/u/taha)\
**Post date:** [June 18, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/an-error-occurred-while-writing-cgi-reply-with-fcgiwrap/170534/2 "2009-06-18T16:47:42Z")

</div>

Ah, solved it already. The application did not have write rights to one  
directory where it required those.

Cheers.

Posted at Nginx Forum:

> **[Re: "An error occurred while writing CGI reply" with fcgiwrap](https://forum.nginx.org/read.php?2,3068,3072#msg-3072)**
>
> Hi, I am using fcgiwrap from http://nginx.localdomain.pl/wiki/FcgiWrap to run Perl scripts with Nginx (0.6.35) and first it functioned just fine but then suddenly it stopped working with one application (Movable Type) and only returns message...
