0) { stream_copy_to_stream($sock, $output, $content_length); } // send response $fd = fopen($file, 'rb'); stream_copy_to_stream($fd, $sock); fclose($sock); } exit(0); } function http_server_kill($pid) { posix_kill($pid, SIGTERM); pcntl_waitpid($pid, $status); } ?>