PHP Fatal error: Allowed memory size of 134 bytes exhausted

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6846241 bytes) in xxx.php on line 1。

Inherited a legacy of inter-server data synchronization, in the implementation of the operation, see the call interface everything is normal, normal can be invoked, but in the end the result is that curl out of the "500 Internal Server Error".

Obviously Call Interface B A server in the server, then the server in the B view, you can see the interface is indeed called, and the middle of the interface did not cause a problem because the class or other methods such as, why is there 500? ? ?

Best not the solution. . .

Finally, I can not find any hints, and look through a bit apache's error.log, to see such a passage "PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 6846241 bytes) in xxx.php on line 1"

Hell? ! Memory is not enough? ? ?
Is the amount of data stored in a single interface too much, more than the limit set php?

Sign Kanliaoyikan php.ini, find the "memory_limit = 128M" configuration, 128M so much memory is not enough yet! ! ?

In the interface was temporarily set a bit, add a line ini_set ( 'memory_limit', '256M'), then execute interface to access, OK, successfully completed, 200.

After checking, because it is a test environment for testing, too dirty data between servers, resulting in variable holds after all to get beyond the limit of memory usage, then an error has occurred.

There are two approaches to solve the problem:

The first method is enhanced by modifying the configuration inclusive:
1, the php.ini configuration, the larger the change memory_limit (Note that the other will result in a bad influence);
2, used in the interface ini_set ( ' memory_limit ',' 256M ') temporarily expand the available memory.

The second method is by processing logic optimized code, to limit the amount of data each taking within the controllable range.

Published 105 original articles · won praise 58 · views 410 000 +

Guess you like

Origin blog.csdn.net/ljl890705/article/details/78481024