I have a PHP script that resizes an image, but when I try to access this page, it seems to get partway through processing the page, then the PHP process handling the request dies. I receive in the browser the output of the script as far as it got.

Other php pages work okay.

I'm running PHP using spawn-fcgi to spawn the PHP processes, on Ubuntu.

To try and debug it, I added the following to my php.ini:

log_errors = on
error_log = /home/djeyewater/logs/php-errors.log
and modified the spawn-fcgi init script to start PHP like so:

$FCGI_DAEMON -s $FCGI_SOCKET -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE -- $FCGI_PROGRAM -c /home/djeyewater/webapps/php_fcgi/lib/php.ini 2>>/home/djeyewater/logs/php-fcgi-err.log
Not sure if that is the correct way to record stderr from spawn-fcgi?

Anyway, after restarting php I got no errors (from the page I'm having problems with) recorded in the php error log or the spawn-fcgi stderr file.
In the server error log I get the following, which doesn't really tell me anything except that PHP died:
2010/01/12 15:29:33 [error] 7654#0: *15 readv() failed (104: Connection reset by peer) while reading upstream, client:, server: www.photosite.com, request: "POST /admin/upload.xhtml HTTP/1.0", upstream: "fastcgi://unix:/home/djeyewater/webapps/spawn-fcgi/php-fastcgi.sock:", host: "www.photosite.com", referrer: "http://www.photosite.com/admin/upload.xhtml";
Could anyone advise me on how to debug this error, or how to fix it?