title: Fatal error: Out of memory in WordPress running on AWS EC2
body: <p>I launch an instance (EC2): Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type
  all the options are default (free tier)
  In installed Wordpress and run it online for test.</p>
  <p>I configured as bellow :
  sudo vim /etc/php.ini (php.ini file)</p>
  <blockquote>
  <p><code>memory_limit = 1024M</code></p>
  </blockquote>
  <p>I added two line in wp-config.php</p>
  <blockquote>
  <p><code>define('FS_METHOD','direct');</code> <br>
  <code>define('WP_MEMORY_LIMIT', '1024M');</code></p>
  </blockquote>
  <p>Using .htaccess</p>
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /wordpress/
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /wordpress/index.php [L]
  &lt;/IfModule&gt;
  # END WordPress
  
  &lt;IfModule mod_php7.c&gt;
  php_value memory_limit 1024M
  &lt;/IfModule&gt;
  </code></pre>
  <p>But sometimes I still get the error messages like:</p>
  <blockquote>
  <p>Fatal error: Out of memory (allocated 28311552) (tried to allocate
  65536 bytes) in Unknown on line 0</p>
  </blockquote>
  <p>or</p>
  <blockquote>
  <p>Fatal error: Out of memory (allocated 24117248) (tried to allocate
  143360 bytes) in file...</p>
  </blockquote>
  <p>Does anyone know how to fix this issue? Please help?
  In php.ini file I see <br>
  <code>; Maximum amount of memory a script may consume (128MB)</code><br>
  <code>; http://php.net/memory-limit </code><br>
  before line <br>
  <code>memory_limit = 1024M</code><br>
  Is that mean even I set memory_limit = 1024M the memory limit still is 128MB on EC2?</p>