CodeIgniter Forums
ERROR in mysqli_driver.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: ERROR in mysqli_driver.php (/showthread.php?tid=69817)



ERROR in mysqli_driver.php - nvv - 01-21-2018

Hello.

I am having a  problem with mysqli_driver.php.

ERROR - 2018-01-21 16:06:50 --> Severity: Warning --> mysqli::query(): MySQL server has gone away ...\system\database\drivers\mysqli\mysqli_driver.php 305
ERROR - 2018-01-21 16:06:50 --> Severity: Warning --> mysqli::query(): Error reading result set's header ...\system\database\drivers\mysqli\mysqli_driver.php 305
ERROR - 2018-01-21 16:06:50 --> Query error: MySQL server has gone away - Invalid query: SELECT * FROM `shoes` WHERE `strId` = '0047TANWU' LIMIT 1

The table `shoes` is have 530 000 rows...

How can I fix this error?


RE: ERROR in mysqli_driver.php - php_rocs - 01-21-2018

@nvv,
More information is needed. Have you configured CI correctly (the database parameters)? Is PHP configured correctly? What version of PHP are you using? Is you MySQL database active? What version of CI are you using?


RE: ERROR in mysqli_driver.php - nvv - 01-21-2018

(01-21-2018, 08:58 AM)php_rocs Wrote: @nvv,
More information is needed.  Have you configured CI correctly (the database parameters)? Is PHP configured correctly? What version of PHP are you using? Is you MySQL database active?  What version of CI are you using?

CI = 3.1.7
APACH-PHP7
MySQL-5.7
PHP7

Until the error, everything worked fine. Now everything is working fine.

Increased the parameters in the mysql config.
But the mistake was. Perhaps you need to test this point.


Thanks!


RE: ERROR in mysqli_driver.php - InsiteFX - 01-21-2018

This can be caused by lots of different things.

Code:
mysql/bin/my.ini

setting:

connect_timeout = 300
default_socket_timeout = 300


This should be set to FALSE because it causes problems.

PHP Code:
// ./application/config/database/php
'pconnect' => TRUE// change this to false 

Reconnecting / Keeping the Connection Alive

If the database server’s idle timeout is exceeded while you’re doing some heavy PHP lifting (processing an image,
for instance), you should consider pinging the server by using the reconnect() method before sending further queries,
which can gracefully keep the connection alive or re-establish it.

PHP Code:
$this->db->reconnect(); 

You may also need to raise the MySQL packet size...


RE: ERROR in mysqli_driver.php - nvv - 01-22-2018

'pconnect' was FALSE.

Ok. I will try.


RE: ERROR in mysqli_driver.php - nvv - 01-27-2018

Sorry, MySQL was 5.6

I was updated MySQL to 5.7 and site is working fine now.

Fanks.