1

I just installed a clean LEMP stack on a droplet on digital ocean. Everything seems te be working fine. It I notice that if I do something on the command line with php. I will get a php fatal error about memory exhausted:

PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 65536 bytes) in Unknown on line 0

I tried rebooting the system and run the commands immediately. Still the same problem. I also changed the memory limit from the default 128M to 265M. which is also reflected by phpinfo().

Finally, the free command shows that there is memory left, and also swap is enabled: total used free shared buffers cached Mem: 501792 468888 32904 5412 68584 253116 -/+ buffers/cache: 147188 354604 Swap: 1048572 4396 Did I do something wrong with the php5-fpm configuration? I usually work with a LAMP stack ... so I don't know if this is nginx php5-fpm specific.

  • 1
    262144 thats not a lot of memory you have allocated –  Nov 02 '15 at 23:13
  • That was my first thought too. That is roughly 26kb of memory that is set as the limit. Are you sure you set the allowed memory size right? – Jonathan Kuhn Nov 02 '15 at 23:15
  • i think `echo 'fish';` takes up more memory than that. so clearly the settings for the limits are wrong, somewhere - whats in php.ini? can you post the actual phpinfo results for memory allocation? –  Nov 02 '15 at 23:17
  • maybe this answer could help you: http://stackoverflow.com/questions/415801/allowed-memory-size-of-33554432-bytes-exhausted-tried-to-allocate-43148176-byte – Daniel Ojeda Nov 02 '15 at 23:18
  • 1
    .. command line memory allocation may not be the same as the allocation 'via web server' they often use separate php.ini files, on the command line run `php -i` –  Nov 02 '15 at 23:19
  • I found the problem. It has been mentioned in other threads too. The php.ini in cli folder was not set correctly: 128MB instead of 128M. Everything was working because the fpm was set correctly. – user2380892 Nov 02 '15 at 23:30

0 Answers0