Running a PHP script under mod_fcgid was causing a 500 error to be returned. The error logged was:
mod_fcgid: read data timeout in 40 seconds
(110)Connection timed out: mod_fcgid: ap_pass_brigade failed in handle_request function
There is a 40 second default on the script running. To fix this for the requirement we needed to modify the vhosts.conf file for the Plesk domain and put in:
<IfModule mod_fcgid.c>
ProcessLifeTime 7200
IPCCommTimeout 7200
IPCConnectTimeout 300
</IfModule>
And rebuild the configuration file with: /usr/local/psa/admin/bin/websrvmng –reconfigure-vhost –vhost-name=domain