MARIADB - Error while sending QUERY packet (not max_allowed_packet)(MARIADB - 发送 QUERY 数据包时出错(不是 max_allowed_packet))
问题描述
我在使用 PHP7 脚本将数据保存到数据库 (MariaDB) 时遇到问题.该脚本在以前的托管包上运行良好,但在我的新 VPS 上却不行.
I'm having an issue with a PHP7 script saving data to a database (MariaDB). The script worked fine on a previous hosting package, but not on my new VPS.
Warning: Error while sending QUERY packet. PID=1208 in ...
其他线程导致我查看设置,但我的设置是:
Other threads caused me to look at settings, but my settings are:
- max_allowed_packet = 1GB
- wait_timeout = 10
我已经进一步审查了这个问题,发现查询本身没有任何问题(它在 phpMyAdmin 中执行良好).
I've reviewed the issue further and found there is nothing wrong with the query itself (it executes fine in phpMyAdmin).
这似乎与在不关闭连接的情况下连续执行两个查询有关(第二个失败).
相同的脚本在旧主机上运行良好,它必须是一个设置 - 有人有什么想法吗?
The same script ran fine on the old hosting, it must be a setting - does anyone have any ideas?
非常感谢,本
MariaDB 配置(/etc/my.cnf):
MariaDB config (/etc/my.cnf):
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1GB
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
innodb_file_per_table
max_connections=70
max_user_connections=30
wait_timeout=10
interactive_timeout=50
long_query_time=5
推荐答案
问了1分钟后,我已经回答了我自己的问题.这就是问题所在:
1 minute after asking it, I've answered my own question. This was the issue:
wait_timeout=10
我之前的托管配置有 =180,这使得我写得不好的脚本可以正常工作.在 =10 下,完成任务的时间还不够长.我现在已将其延长到 180,但确实应该为此添加句柄.
My previous hosting configuration had =180 which make my poorly written script work. Under the =10 it's just not long enough for the task to complete. I have lengthened it to 180 now but should really add handle for this.
这篇关于MARIADB - 发送 QUERY 数据包时出错(不是 max_allowed_packet)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MARIADB - 发送 QUERY 数据包时出错(不是 max_allowed_packet)
基础教程推荐
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01