title: Nginx or PHP FPM ignores memory_limit in php.ini
body: <p>Server info: Ubuntu Server, Nginx, PHP FPM</p>
  
  <p>in <code>/etc/php5/fpm/php.ini</code> I have: <code>memory_limit = 512M</code>
  in <code>/etc/php5/fpm/php-fpm.conf</code> I have: <code>php_admin_value[memory_limit] = 512M</code></p>
  
  <pre><code>php_value[memory_limit] = 512M
  </code></pre>
  
  <h2>My phpinfo looks like:</h2>
  
  <p>PHP Version 5.3.10-1ubuntu3.6</p>
  
  <h2>System Build Date</h2>
  
  <p>Linux snserver 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 Mar 11 2013 14:34:24 </p>
  
  <h2>Server API</h2>
  
  <p><code>FPM/FastCGI</code></p>
  
  <h2>Virtual Directory Support</h2>
  
  <p>disabled</p>
  
  <h2>Configuration File (php.ini) Path</h2>
  
  <pre><code>/etc/php5/fpm 
  </code></pre>
  
  <h2>Loaded Configuration File</h2>
  
  <p><code>/etc/php5/fpm/php.ini</code></p>
  
  <p>Scan this dir for additional .ini files
  <code>/etc/php5/fpm/conf.d</code> </p>
  
  <h2>Additional <code>.ini</code> files parsed</h2>
  
  <p><code>/etc/php5/fpm/conf.d/curl.ini, /etc/php5/fpm/conf.d/gd.ini, /etc/php5/fpm/conf.d/mcrypt.ini, /etc/php5/fpm/conf.d/memcache.ini, /etc/php5/fpm/conf.d/mysql.ini, /etc/php5/fpm/conf.d/mysqli.ini, /etc/php5/fpm/conf.d/pdo.ini, /etc/php5/fpm/conf.d/pdo_mysql.ini</code>
  ...</p>
  
  <p>This server is protected with the Suhosin Patch 0.9.10
  Copyright (c) 2006-2007 Hardened-PHP Project Copyright (c) 2007-2009 SektionEins GmbH</p>
  
  <p>This program makes use of the Zend Scripting Language Engine:
  Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
      with Xdebug v2.2.2, Copyright (c) 2002-2013, by Derick Rethans</p>
  
  <p>... </p>
  
  <h2>memory_limit</h2>
  
  <p>128M</p>
  
  <h2>upload_max_filesize</h2>
  
  <p>20M</p>
  
  <p>in /etc/nginx/nginx.conf:</p>
  
  <pre><code>    user www-data;
  
  worker_processes 2;
  
  pid /var/run/nginx.pid;
  
  events {
      worker_connections 768;
      # multi_accept on;
  }
  
  http {
      client_max_body_size 20M;
  
      ##
  
      # Basic Settings
  
      ##
      fastcgi_buffers 16 16k;
  
      fastcgi_buffer_size 32k;
  
      proxy_buffers 4 512k;
  
      proxy_buffer_size 256k;
  
      proxy_busy_buffers_size 512k;
  
      fastcgi_read_timeout 3600;
  
      sendfile on;
  
      tcp_nopush on;
  
      tcp_nodelay on;
  
      keepalive_timeout 300;
  
      keepalive_requests 50;
  
      #ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;
  
          #ssl_prefer_server_ciphers on;
  
          #ssl_protocols TLSv1;
  
          #ssl_session_cache shared:SSL:10m;
  
          #ssl_session_timeout 10m;
  
      types_hash_max_size 2048;
  
      # server_tokens off;
  
      # server_names_hash_bucket_size 64;
  
      # server_name_in_redirect off;
  
      include /etc/nginx/mime.types;
  
      default_type application/octet-stream;
  
      ##
      # Logging Settings
      ##
  
      access_log /var/log/nginx/access.log;
  
      error_log /var/log/nginx/error.log;
  
      ##
      # Gzip Settings
      ##
  
      gzip on;
      gzip_disable "msie6";
  
      # gzip_vary on;
      # gzip_proxied any;
      # gzip_comp_level 6;
      # gzip_buffers 16 8k;
      # gzip_http_version 1.1;
      # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
      ##
      # nginx-naxsi config
      ##
      # Uncomment it if you installed nginx-naxsi
      ##
  
      #include /etc/nginx/naxsi_core.rules;
  
      ##
      # nginx-passenger config
      ##
      # Uncomment it if you installed nginx-passenger
      ##
  
      #passenger_root /usr;
      #passenger_ruby /usr/bin/ruby;
  
      ##
      # Virtual Host Configs
      ##
  
      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
  }
  </code></pre>
  
  <hr>
  
  <p>The problem is when i change  <code>upload_max_filesize</code> size then the <code>phpinfo</code> will show the new value, but when I change <code>memory_limit</code> then nothing changes. 
  I guess in somewhere the memory_limit is overwrited. But i cannot find it. 
  Can anyone help me?</p>