php 7.4.28 mysqi and "MySQL server has gone away"

210 views
Skip to first unread message

Massimo S.

unread,
Feb 25, 2022, 3:08:16 PM2/25/22
to apa...@googlegroups.com
Hi all,


this simple code:

<?php
$conn = mysqli_connect($server, $username, $password, $db);
$query_str = 'SELECT * FROM news';

was working perfectly on php 5.6.40 and now under 7.4.28 works randomly
sometimes ok and sometimes it show just a blank page and if i activate
display error it show "MySQL server has gone away"

this is not possible since all other websites on the same server works correctly
at the same time

what i see in mysql transaction log?

220225 21:02:35
39 Connect us...@192.168.x.y on mydb
39 Query SELECT * FROM news
40 Connect us...@192.168.10.3 on mydb
40 Query SELECT * FROM news
41 Connect us...@192.168.10.3 on mydb
41 Query SELECT * FROM news
41 Quit

39 and 40 bad
41 good

i'm reading a lot of stuff around the internet about this "mysql server has gone away"
but i don't have found any solution
i've tried everything, eved the DROP of the DB and re-import of it
with no success at all

any idea?
could be some issue of the mysqli.dll library?

massimo

Paul Smedley

unread,
Feb 25, 2022, 4:16:00 PM2/25/22
to apa...@googlegroups.com
Hi Max,
I see a misapplied patch between 5.6.40 and 7.4.28 that I had already
corrected in 8.0.x and 8.1.x

Rebuilding now, and I'll post a new build once it's done.

Cheers,

Paul

Paul Smedley

unread,
Feb 25, 2022, 4:31:06 PM2/25/22
to apa...@googlegroups.com

Massimo S.

unread,
Feb 25, 2022, 4:38:02 PM2/25/22
to apa...@googlegroups.com
Il 25/02/2022 22:30, Paul Smedley ha scritto:
> https://smedley.id.au/tmp/php-7.4.28-os2-20220226.zip

unfortunately it does not help :(

massimo

Paul Smedley

unread,
Feb 26, 2022, 12:31:41 AM2/26/22
to apa...@googlegroups.com
I'm assuming you've tried the suggestions in
https://haydenjames.io/mysql-server-has-gone-away-error-solutions/ ?

On 26/2/22 06:38, Massimo S. wrote:

Massimo S.

unread,
Feb 26, 2022, 6:40:18 AM2/26/22
to apa...@googlegroups.com


Il 26/02/2022 06:31, Paul Smedley ha scritto:
> I'm assuming you've tried the suggestions in https://haydenjames.io/mysql-server-has-gone-away-error-solutions/ ?

i've tried everything

if you mean this:

wait_timeout=90
net_read_timeout=90
net_write_timeout=90
interactive_timeout=300
connect_timeout=90

of course and it don't help

massimo

Massimo S.

unread,
Feb 26, 2022, 6:43:40 AM2/26/22
to apa...@googlegroups.com


Il 26/02/2022 12:40, Massimo S. ha scritto:
>
>
> Il 26/02/2022 06:31, Paul Smedley ha scritto:
>> I'm assuming you've tried the suggestions in
>> https://haydenjames.io/mysql-server-has-gone-away-error-solutions/ ?
>
> i've tried everything
>
> if you mean this:
>
> wait_timeout=90
> net_read_timeout=90
> net_write_timeout=90
> interactive_timeout=300
> connect_timeout=90
>
> of course and it don't help
>
> massimo

and this

max_allowed_packet = 512M
don't help

innodb_buffer_poo_size at 256M or 512M
nothing change

max connections it's impossible, i've set to 350 since years ago

Paul Smedley

unread,
Feb 26, 2022, 4:18:51 PM2/26/22
to apa...@googlegroups.com
What about mysql settings in php.ini?

wkit...@windstream.net

unread,
Feb 27, 2022, 2:39:02 AM2/27/22
to apa...@googlegroups.com
On 2/26/22 6:43 AM, Massimo S. wrote:
> innodb_buffer_poo_size at 256M or 512M

i assume this is a typo? "poo" vs "pool"

--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list where it belongs!*

Massimo S.

unread,
Feb 27, 2022, 8:15:22 AM2/27/22
to apa...@googlegroups.com


Il 26/02/2022 22:18, Paul Smedley ha scritto:
> What about mysql settings in php.ini?

generic:

(it was 256)
memory_limit = 1024M
max_execution_time = 60 max_input_time = 120

mysql and mysqli part:

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
; mysql.default_port =
mysql.default_port = 3306

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = 192.168.10.4

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user = root

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; mysql.connect_timeout = 180

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[MySQLi]

; Maximum number of links. -1 means no limit.
mysqli.max_links = -1

; Default port number for mysqli_connect(). If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
mysqli.default_port = 3306

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off



massimo

Massimo S.

unread,
Feb 27, 2022, 8:16:38 AM2/27/22
to apa...@googlegroups.com


Il 27/02/2022 08:39, wkit...@windstream.net ha scritto:
> On 2/26/22 6:43 AM, Massimo S. wrote:
>> innodb_buffer_poo_size at 256M or 512M
>
> i assume this is a typo? "poo" vs "pool"
>

yes of course

massimo

Massimo S.

unread,
Feb 27, 2022, 8:24:44 AM2/27/22
to apa...@googlegroups.com


Il 27/02/2022 14:15, Massimo S. ha scritto:
>
> ; Allow or prevent reconnect
> mysqli.reconnect = Off

i've tried to put this to ON
but it don't help

massimo
Reply all
Reply to author
Forward
0 new messages