I want to continue the execution of the script after closing the connection.
Here is what i tried ..
log_message('debug','Test started' );
//Show all errors
error_reporting(E_ALL);
//Configurations
@ini_set("output_buffering", "Off");
//@ini_set('implicit_flush', 1);
@ini_set('zlib.output_compression', 0);
//User abort & maximum time
ignore_user_abort(true);
set_time_limit(0);
//check the level
if (ob_get_level() == 0) {
ob_start();
}
//Actual output
echo('hello world ...');
// get buffer length
$size = ob_get_length();
// set content length
header("Content-Length:$size");
//close the connection
header("Connection:close");
// content encoding
header("Content-Encoding: none");
//content type
header("Content-Type: text/html; charset=utf-8");
//Release buffer
ob_flush();
ob_end_flush();
flush();
// Continue on background
// never gonna execute from here ...
sleep(20);
//There is no aliens (class) exists , expecting error on log
$alien = new alienEncoder();
$alien->get_aliens( new alienDecoder() );
log_message('debug','End Test');
Everything works well execpt the CONTINUE
part ( it stops after FLUSH
), There is no error log on server.
The same code works in another host, but not here.
Please help.
SERVER : IIS 7.5 Shared, Using Codeigniter
Notes
- There is no
alienEncoder()
or something like that, so i am expecting some error log on server, but there is no error - ResponceBufferLimit is set to zero
- using CGI/FastCgi
PHP-FPM has a function especially for this purpose,
fastcgi_finish_request()
Though I have no idea how to run it with IIS