PHP - MySQL PDO最大查询大小 [英] PHP - MySQL PDO maximum query size

查看:746
本文介绍了PHP - MySQL PDO最大查询大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP中使用MySQL PDO从数据库中检索非常长的字符串(大约1-5mb)。当我在本地机器上测试时,一切工作正常。但是,在我的活动服务器上,执行select语句时,返回的最大字符串大小为1048576字节,这正好是1MB。

I'm using MySQL PDO in PHP to retrieve very long string (about 1-5mb) from the database. When tested on my local machine, everything worked fine. However, on my live server, when executing a select statement, the maximum string size returned is 1048576 bytes, which is exactly 1MB.

因此,由于代码是相同的,这必须是PHP或MySQL设置中的东西。我有以下:

Hence, since the code is the same, this must be something in the PHP or MySQL settings. I have the follow:

php.ini

post_max_size = 20M

my.cnf

max_allowed_packet = 20M

因此我假设我没有设置正确的变量,因为限制仍然在1MB。有谁知道要设置什么?

So I assume I'm not setting the correct variables, since the limit is still at 1MB. Does anyone know what to set?

推荐答案

啊,我一直在错误的地方看。这不是PHP或MySQL的问题,而是PDO的一个。您必须更改PDO :: MYSQL_ATTR_MAX_BUFFER_SIZE。

Ahhh, I've been looking in the wrong place. This is not a PHP or MySQL problem, but a PDO one. You have to change the PDO::MYSQL_ATTR_MAX_BUFFER_SIZE.

Mysql PDO最大LONGBLOB获取时的数据长度

这篇关于PHP - MySQL PDO最大查询大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆