保持活力控制是否使用客户端TCP keepalive.默认值为1,表示打开,但是如果为0,则可以将其更改为0,表示关闭. 不需要keepalives.连接将忽略此参数 通过Unix域套接字制作.Controls whether client-side TCP keepalives are used. The default value is 1, meaning on, but you can change this to 0, meaning off, if keepalives are not wanted. This parameter is ignored for connections made via a Unix-domain socket. keepalives_idle控制不活动的秒数,在此之后TCP应该向服务器发送一个保持活动消息.零使用值 系统默认值.对于通过进行的连接,将忽略此参数 Unix域套接字,或者是否禁用了keepalive.只有 在使用TCP_KEEPIDLE或TCP_KEEPALIVE套接字的系统上受支持 该选项可用,并且在Windows上;在其他系统上,它没有 效果.Controls the number of seconds of inactivity after which TCP should send a keepalive message to the server. A value of zero uses the system default. This parameter is ignored for connections made via a Unix-domain socket, or if keepalives are disabled. It is only supported on systems where the TCP_KEEPIDLE or TCP_KEEPALIVE socket option is available, and on Windows; on other systems, it has no effect. keepalives_interval控制秒数,在该秒数之后,应重新传输服务器未确认的TCP Keepalive消息.一种 零值使用系统默认值.该参数被忽略 通过Unix域套接字建立的连接,或者如果keepalive是 禁用的.仅在TCP_KEEPINTVL的系统上支持 套接字选项可用,并且在Windows上;在其他系统上,它具有 没有效果.Controls the number of seconds after which a TCP keepalive message that is not acknowledged by the server should be retransmitted. A value of zero uses the system default. This parameter is ignored for connections made via a Unix-domain socket, or if keepalives are disabled. It is only supported on systems where the TCP_KEEPINTVL socket option is available, and on Windows; on other systems, it has no effect.示例:<?$db = new PDO('pgsql:dbname=mydb;host=localhost;user=myuser;password=mypass;keepalives_idle=60');?> 这篇关于TCP保持活动PDO连接参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 07:09