0) { $line = fread($sock, $content_length); fwrite($output, "$line\r\n"); } // send response fputs($sock, $file); fclose($sock); } exit(0); } function http_server_kill($pid) { posix_kill($pid, SIGTERM); pcntl_waitpid($pid, $status); } ?>