Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128440 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 764CD1A00BC for ; Fri, 8 Aug 2025 16:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1754671255; bh=T9S1zXgKCI8ktxNj8KXU7R360uoY4LRamBW/t1Ebijc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Q1O1Bo1A7RF0mAUPC4npBYw1YHxspGoFVwfO9Q3RR3d44qZaZB+TE4NjVTQmFrpet glok/No+JuV9HB4s8vMHsm2eLn6m43ycJOH8RGPzQBIAI9xjLGYarjETQRe4juO3lG faMiQA/2ydzVaomDn2AvDzAxCBEvhdSQO9GYXQgFuIvcHBG3HhXpHsD2sTaRBRCZLc 3UtN/79mkq9q3RK3KKKwuBG7xnM2ySn6e2ASK3vjWnYYL0HBbPeZzL9B7cbRam15S3 H8/S0GRwBYystmy6w3tOmzwwzSnW82M8o49IgOatC8t7oUlFaPy/wWj1k9qF9BAxMI VkOy9heht1bEw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7CDC3180081 for ; Fri, 8 Aug 2025 16:40:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,THIS_AD autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 8 Aug 2025 16:40:54 +0000 (UTC) Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-332612dc0d1so18685241fa.1 for ; Fri, 08 Aug 2025 09:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754671351; x=1755276151; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T9S1zXgKCI8ktxNj8KXU7R360uoY4LRamBW/t1Ebijc=; b=kyewE3l1QuSGsv1qylb/xbvMW5PE/tdkGQgwwsJV6KKVZm4PdPVKf1qiRlRx3X1ZPD TKbWp9uWwkoGueVCqSgS1ylQzOm/+bjZkvG+VJ42aig2eZl1u3GWz35XO2MWPMCJOadf RpbX32DgT5Hv/mX/bMYauFhX+Tq6Sm64I06pDtBRynFkOylzza/13LIwOXaQcjz38oAK cjViPnZZwrw4mCSIaS0RFts6SD1Af/VuH+PXXAeMDtPdZdrHjPdMGBFxweZxalSdJzpI QsasJTeXfc+nTnmXYa9+ul3cFNoFDewXus7XeY9yGUYYJWV9XzxsYj8tAGCAFlNHfPF0 UE9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754671351; x=1755276151; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T9S1zXgKCI8ktxNj8KXU7R360uoY4LRamBW/t1Ebijc=; b=kZZATlnIXymSCoK4D5iaBjS3VZ7tyZ2hBFKBSgzpbJ+rIfuTkxBpwn4IpdsUdHEdET 3+bMu9Cw6GqFOXtYzXApNsqX2CpKURX0EIM2eha7DgYIdzVJAInrsEKsx9OuIUevbr87 E/hyqDgQx7IqREHixDB/YcnwiZk5di/O9jQ8VFfv3ZT27CqyFmG+xf2S0t967Xn/RZNT 5qQdPU2d0FoC5C78AnDk0ECGFIoP8R+P6YAUQpu3L/SZ7qJN5iHf/z9EgC9h+QGoOx5i 3ozhUHxim3YtriAbp4VMB5n0oqEaYQU5ywrfLRmrfMg+F0pNuTtzQ4JAIDcyTkzsV1q1 KDzg== X-Gm-Message-State: AOJu0Yy9P82MO7aOS5OiLk6rA3WS14HGVUPI3x/uTCpqHeUv7nSYPdLJ HkT7ZXVgmTJPjBkxcAvz8FVkzFaHAUBsYmFh/tXjZn/gJ2D5ELzCB/fDRXBzVCnrSNH9MjVwMxR EL+zXUV+XiNJqwbpVsCodBphlwPCu+pI= X-Gm-Gg: ASbGncvSuaooLMqRBF4EAb19t9ibjgQspUC/i1t5m4B3wOH9yI2nCORUwZHcQGWEC6c l3ysjUNmHDmCv8FpaPpOJw0UIeNfwN4SebtIcEJlcnGPjthtNPHfAgt6zksI7xWkntOT7llvXFE Eg89I30xzSFUqNyyl4CbZB9MzElxL+xpBil5D1fDZ/a1XZUX0wzwhD8QtCulRgbXL7xeAXSs+nc oqDB1k= X-Google-Smtp-Source: AGHT+IE5PjCVYHpuT2tU20ZgpWzQuuyUr81KlZv0JZpyz01l6gZOYqu2/FZiDbDczRbeafgaK7QP8gXVcBUViWFRTds= X-Received: by 2002:a05:6512:2393:b0:553:341f:12a3 with SMTP id 2adb3069b0e04-55cc011adcemr860807e87.39.1754671351211; Fri, 08 Aug 2025 09:42:31 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 8 Aug 2025 19:42:19 +0300 X-Gm-Features: Ac12FXz6BHGmFNI4aLZrLcdsPJAE1-qJuv0JbuDeH5skpmiPmuspv-EWOFFAAeo Message-ID: Subject: Re: [PHP-DEV] PDO Disconnect and Persistent Connect To: Robert Wolf Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000962d7c063bdd42ab" From: tekiela246@gmail.com (Kamil Tekiela) --000000000000962d7c063bdd42ab Content-Type: text/plain; charset="UTF-8" On Fri 8 Aug 2025, 19:32 Robert Wolf, wrote: > Persistent connection helps avoid the overhead involved in creating and >> authorizing a new connection on the server. >> > > That only applies if you are creating multiple PDO objects and expecting > re-use of the kept-alive underlying connection, correct? > > If persistent connections were removed, it is true that any users > utilizing PDO in this ad-hoc fashion and expecting connection keepalive > would be impacted. Granted, that potential impact may not be tenable, but > the workaround would seem rather straightforward to communicate to users > and to implement - that workaround being for the user to introduce a PDO > singleton to hold the object reference as long as you wish the connection > to live for. > No, They are reusable across different http requests. There's no point in reusing them in the same request. On the first access to the website a new connection is established. On the second access the same connection is reused provided the first request is done with it. This way consecutive requests to the website do not need to open a new costly connection. > --000000000000962d7c063bdd42ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri 8 Aug 2025, 19:32 Robert = Wolf, <rposky@gmail.com> wrot= e:
Persistent connection= helps avoid the overhead involved in creating and authorizing a new connec= tion on the server.

That only ap= plies if you are creating multiple PDO objects and expecting re-use of the = kept-alive underlying connection, correct?

If pers= istent connections were removed, it is true that any users utilizing PDO in= this ad-hoc fashion and expecting connection keepalive would be impacted. = Granted, that potential impact may not be tenable, but the workaround would= seem rather straightforward to communicate to users and to implement - tha= t workaround being for the user to introduce a PDO singleton to hold the ob= ject reference as long as you wish the connection to live for.
<= /div>


No,=C2=A0They are reusable across different ht= tp requests. There's no point in reusing them in the same request.=C2= =A0

On the first access = to the website a new connection is established. On the second access the sa= me connection is reused provided the first request is done with it. This wa= y consecutive requests to the website do not need to open a new costly conn= ection.=C2=A0
--000000000000962d7c063bdd42ab--