XML-RPC problem with long running times
| From: | Andreas Schlicker | Date: | Thu, 29 Dec 2005 13:56:41 +0000 |
| Subject: | XML-RPC problem with long running times | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-227970@lists.php.net to get a copy of this message | ||
Hi all,
I'm using Apache/1.3.33 (Unix), PHP/5.0.3, mod_ssl/2.8.22, OpenSSL/0.9.6a.
I wrote a dummy script that is called by a Java program via XML-RPC, waits for some time and replies the start and end times.
<?php
set_time_limit(500);
$xmlServer = xmlrpc_server_create();
function process() {
$result = ini_get('max_execution_time') . "\n";
$result = $result . date("H:i:s") . "\n";
sleep(0);
$result = $result . date("H:i:s") . "\n";
return $result;
}
xmlrpc_server_register_method($xmlServer, 'process', 'process');
$xmlRequest = $HTTP_RAW_POST_DATA;
$xmlResponse = xmlrpc_server_call_method($xmlServer, $xmlRequest, NULL);
#$log = fopen($filename, 'a');
#fwrite($log, $xmlResponse);
#fflusch($log);
#fclose($log);
echo $xmlResponse;
xmlrpc_server_destroy($xmlServer);
?>
If the script sleeps for up to 5 minutes, it works perfectly fine. However, I my real application will run probably an hour or so. If the script takes more than 5 minutes to execute, the client receives an empty response, even the header is missing. If I try to write the $xmlResponse to a file, the client receives a null message.
I wrote a small script without XMLRPC that acted the same way when called by a browser. This worked perfectly (I tested it up to 20 minutes waiting time) even if I used set_time_limit(5) and sleep(500).
Does anybody have an idea how to solve this problem? Thanks in advance.
Andreas