致命错误:允许的内存大小为 134217728 字节已用尽(CodeIgniter + XML-RPC) [英] Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted (CodeIgniter + XML-RPC)

查看:43
本文介绍了致命错误:允许的内存大小为 134217728 字节已用尽(CodeIgniter + XML-RPC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆客户销售点 (POS) 系统,这些系统会定期将新的销售数据发送到一个中央数据库,该数据库将数据存储到一个大数据库中以生成报告.

I have a bunch of client point of sale (POS) systems that periodically send new sales data to one centralized database, which stores the data into one big database for report generation.

客户端 POS 基于 PHPPOS,我已经实现了一个模块,该模块使用标准的 XML-RPC 库将销售数据发送到服务.服务器系统建立在 CodeIgniter 之上,并为 webservice 组件使用 XML-RPC 和 XML-RPCS 库.每当我发送大量销售数据(销售表中的 50 行,以及 sales_items 中与销售中的每个项目相关的单独行)时,我都会收到以下错误:

The client POS is based on PHPPOS, and I have implemented a module that uses the standard XML-RPC library to send sales data to the service. The server system is built on CodeIgniter, and uses the XML-RPC and XML-RPCS libraries for the webservice component. Whenever I send a lot of sales data (as little as 50 rows from the sales table, and individual rows from sales_items pertaining to each item within the sale) I get the following error:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 54 bytes)

128M 是 php.ini 中的默认值,但我认为这是一个很大的数字.事实上,我什至尝试将这个值设置为 1024M,但它所做的只是需要更长的时间才能出错.

128M is the default value in php.ini, but I assume that is a huge number to break. In fact, I have even tried setting this value to 1024M, and all it does is take a longer time to error out.

至于我采取的步骤,我尝试禁用服务器端的所有处理,并操纵它返回一个固定的响应,而不管输入如何.但是,我认为问题在于数据的实际发送.我什至尝试禁用 PHP 的最大脚本执行时间,但它仍然出错.

As for steps I've taken, I've tried disabling all processing on the server-side, and have rigged it to return a canned response regardless of the input. However, I believe the problem lies in the actual sending of the data. I've even tried disabling the maximum script execution time for PHP, and it still errors out.

推荐答案

Change the memory_limit by ini_set('memory_limit', '-1'); is 不是 正确的解决方案.请不要那样做.

Changing the memory_limit by ini_set('memory_limit', '-1'); is not a proper solution. Please don't do that.

您的 PHP 代码可能在某处存在内存泄漏,并且您告诉服务器只使用它想要的所有内存.你根本就不会解决这个问题.如果您监控您的服务器,您会发现它现在可能已经用完了大部分 RAM,甚至正在交换到磁盘.

Your PHP code may have a memory leak somewhere and you are telling the server to just use all the memory that it wants. You wouldn't have fixed the problem at all. If you monitor your server, you will see that it is now probably using up most of the RAM and even swapping to disk.

您可能应该尝试追踪代码中的违规代码并修复它.

You should probably try to track down the offending code in your code and fix it.

这篇关于致命错误:允许的内存大小为 134217728 字节已用尽(CodeIgniter + XML-RPC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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