Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP mysqli connections dropping after 24 hours [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
tld
Veteran
Veteran


Joined: 09 Dec 2003
Posts: 1601

PostPosted: Fri Jul 17, 2020 12:16 pm    Post subject: PHP mysqli connections dropping after 24 hours [SOLVED] Reply with quote

I'm posting this as solved so as to hopefully prevent others from the headaches we had with this one...also to get it our on search engines etc.

We have some php processes that can end up aggregating potentially billions of rows of data, which can obviously result is long running SQL. What we ran into in a recent version of our product that didn't happen previously is that the mysqli connection would just timeout and disconnect after 24 hours. This had us going crazy, especially because we assumed it was a mysql issue, and we couldn't find any configuration that might be related.

Sometimes it seems like the PHP devs seem to like to change shit just to screw with everyone. It turns out that in PHP 7.2, for reasons unknown, the default value for mysqlnd.net_read_timeout (the read timeout for the mysql native driver) changed from 31536000 (1 year) to 86400 (24 hours). Why?? Anyway, uncommenting this in the cli's php.ini fixed this for us:
Code:
;mysqlnd.net_read_timeout = 31536000

Hopefully this will save someone the grief we went through. It's also worth noting that this is NOT mentioned anywhere in the PHP 7.2 upgrade guides. What was gained with making such an obscure change with potentially huge ramifications? Don't get me started.

Tom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum