PHP: [16:31:12] [Server thread/CRITICAL]: ErrorException: "mysqli::prepare(): MySQL server has gone away" (EXCEPTION) in "plugins/BanSystemv1/src/BanSystem/Main" atline 135 What the problem? PHP: public function isBanned($player){ $config = $this->config->get('mysqli'); $name = $player->getName(); $ip = $player->getAddress(); $id = $player->getClientId(); $result = $this->getMysqli()->query("SELECT * FROM ".$config["table"]." WHERE name = '".$name."' or ip = '".$ip."' or id = '".$id."'"); if(!$result->num_rows){ $result->close(); return false; }else{ $result->close(); return true; } }
Add php.ini extension=mysqli PHP: PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli (/var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli: cannot open shared object file: No such file or directory), /var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli.so (/var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli.so: cannot open shared object file: No such file or directory)) in Unknownon line 0Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli (/var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli: cannot open shared object file: No such file or directory), /var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli.so (/var/jenkins_home/workspace/PHP-7.2-Linux-x86_64/bin/php7/lib/php/extensions/no-debug-zts-20170718/mysqli.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Your mysql connector was idle for too long. Catch the exception and ping your mysql connector https://www.php.net/manual/en/mysqli.ping.php Or just implement a keep-alive tactic like the SFTP clients do (keep pinging mysql connector every 5 minutes or so).
"The MySQL server has gone away (error 2006) has two main causes and solutions:Server timed out and closed the connection. To Fix: " - To fix, check that wait_timeout mysql variable in your my.cnf configuration file is large enough. - You may also need to increase the innodb_log_file_size mysql variable in your my.cnf configuration to for example 128MB or higher. "
This error occurs if no queries or pings happen between server and database. The simplest way to fix without changing MySQL settings would be to ping the database every minute.
[QUOTE = "SOFe, post: 65999, member: 4"] Эта ошибка возникает, если между сервером и базой данных не происходит никаких запросов или эхо-запросов. Самый простой способ исправить это без изменения настроек MySQL - это пинговать базу данных каждую минуту. [/ QUOTE] It is the problem bin file.