Nginx or PHP FPM ignores memory_limit in php.ini

后端 未结 7 2204
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 18:49

Server info: Ubuntu Server, Nginx, PHP FPM

in /etc/php5/fpm/php.ini I have: memory_limit = 512M in /etc/php5/fpm/php-fpm.conf

相关标签:
7条回答
  • 2020-12-15 19:06

    You can take Nginx out of the picture, it just passes the request on, it's in php-fpm running your php code.

    you might check your suhosin settings, suhosin.memory_limit.

    when you see your phpinfo output there should be 2 columns, master and local for memory_limit, what do these each show?

    128M is the default for memory_limit in php 5.3

    0 讨论(0)
  • 2020-12-15 19:07

    Ok this is daft but I had memory_limit set to 2GB, which isn't understood. When I changed that to 2000M it worked!

    0 讨论(0)
  • 2020-12-15 19:24

    For me it also ignored php.ini and I had to do the following:

    vim /etc/php-fpm.d/www.conf
    
    php_admin_value[memory_limit] = 10000M ;128M
    

    Then restart php-fpm:

    service php-fpm restart
    
    0 讨论(0)
  • 2020-12-15 19:25

    In /etc/php5/fpm/php-fpm.conf I have php_admin_value[memory_limit] = 512M

    This works for me.

    0 讨论(0)
  • 2020-12-15 19:25

    Also encountered this now and wanted to increase memory of our server in a DigitalOcean droplet

    To summarize, here is what I did

    sudo nano /etc/php5/fpm/php-fpm.conf
    
    -- press Ctrl-W to do a search in nano text editor
    -- if php_admin_value[memory_limit] is there, change it
    php_admin_value[memory_limit] = 512M
    
    sudo service php5-fpm restart
    

    You don't need to restart nginx, just restarting php would be enough.

    0 讨论(0)
  • 2020-12-15 19:26

    The problem may be in fpm the process duplication, even you change your /etc/php5/fpm/php.ini it was not effect.

    • Stop php5-fpm with (ubuntu): sudo service php5-fpm stop
    • check that no more fpm processes: sudo ps ax | grep fpm
    • if any kill it all with: sudo kill -9 pid
    • be sure that you kill all fpm processes
    • restart: sudo service php5-fpm restart
    0 讨论(0)
提交回复
热议问题