Since you crash at the point where you would be saving the raster file in /var/www/html/tmp, I suspect a permissions problem. Does the owner of the mapserver process have write access to that directory?