public function __destruct() { if (is_resource($this->socket)) { fclose($this->socket); } unset($this->pid); unset($this->socket); }