SQL Server 2008 returns “Memory limit of 10240 KB exceeded for buffered query”

穿精又带淫゛_ 提交于 2019-11-30 18:36:19

Change the setting in php.ini.

Section: sqlsrv

Directive: sqlsrv.ClientBufferMaxKBSize.

add two lines in php.ini

extension=php_pdo_sqlsrv_55_ts.dll
extension=php_sqlsrv_55_ts.dll
client_buffer_max_kb_size = '50240'
sqlsrv.ClientBufferMaxKBSize = 50240

You can also change the settings during runtime if you do not require production server to have the php.ini changed (Check if this is applicable with your hosting).

Update the code with following lines:

ini_set('memory_limit','256M'); // This also needs to be increased in some cases. Can be changed to a higher value as per need)
ini_set('sqlsrv.ClientBufferMaxKBSize','524288'); // Setting to 512M
ini_set('pdo_sqlsrv.client_buffer_max_kb_size','524288'); // Setting to 512M - for pdo_sqlsrv

To check if your server supports this, try printing the values after setting the above.

echo ini_get('memory_limit');
echo ini_get('sqlsrv.ClientBufferMaxKBSize');
echo ini_get('pdo_sqlsrv.client_buffer_max_kb_size');

The new values should be the ones we had set in ini_set(). Else, the server does not support runtime configuration changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!