简体   繁体   English

PHP:将持久连接与mysqli_connect一起使用会导致管道破裂错误

[英]PHP: Using persistent connections with mysqli_connect results in Broken Pipe errors

I'm running: 我在跑:

CentOS 5.5 x86
cPanels-11.26.20 RELEASE
Apache 2.2.16
PHP 5.3.3 "--with-mysqli=mysqlnd"
MySQL 5.1.51

When I connect to the database, I use "p:localhost" for the hostname to establish a persistent connection. 当我连接到数据库时,我使用“ p:localhost”作为主机名来建立持久连接。

Yesterday I was using my app no problem before leaving the office. 昨天我在离开办公室之前使用我的应用程序没问题。 Today I tried using it again and it returned an error: 今天,我尝试再次使用它,它返回了一个错误:

mysqli_connect() send of 46 bytes failed with errno=32 Broken pipe mysqli_connect()发送46个字节失败,错误码为errno = 32

If I remove the "p:" before the hostname, the issue is resolved. 如果删除主机名之前的“ p:”,则此问题已解决。 Prepend the "p:" again and the error reappears. 再次在“ p:”前面加上错误,再次出现该错误。 However restarting Apache resolves the issue without the need to edit the hostname. 但是,重新启动Apache可以解决此问题,而无需编辑主机名。 If I run PHP CLI scripts w/ p: in the hostname, they work fine without an error. 如果我在主机名中运行w / p:的PHP CLI脚本,它们可以正常工作而不会出现错误。

Is there a problem with Apache? Apache有问题吗? Does anyone know what could be causing this? 有谁知道是什么原因造成的?

Thanks in advance. 提前致谢。

Probably is because of low memory? 可能是因为内存不足? You had to many persistent connections how took all the RAM. 您必须进行许多持久的连接才能占用所有RAM。 Persistent connections are closed very late so probably new connections are made each time 永久连接关闭很晚,因此每次可能建立新连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM