note 58557 added to ref.exec

From: Date: Tue, 08 Nov 2005 07:54:47 +0000
Subject: note 58557 added to ref.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-98229@lists.php.net to get a copy of this message
About the background functions below, many hosting service disable the exec or passthru functions. It is still possible to run a script in background by sending a 200 OK header to the client’s browser. Here is how: <?php header("HTTP/1.1 200 OK"); header("Content-Length: 0"); flush(); // code to be run in background here // and, of course, no output to the client’s browser from here. ?> And if you need to output something to the client’s browser before executing the code in the background: <?php header("HTTP/1.1 200 OK"); $text = 'Your html code here'; // IE hack to get the flush to work. Not needed for FF. $text = strlen($text) > 256 ? $text : str_pad($text, 256); ob_start(); echo $text; $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); flush(); // code to be run in background starts here. // And, of course, no output to the client’s browser from here. ?> ---- Manual Page -- http://www.php.net/manual/en/ref.exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58557 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58557&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58557&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98229) next »