title: PHP script execution exceeding memory limit, even though limit is higher
body: <p>I have a PHP script on a Linux server that I am executing via command line like so: <code>php script.php</code> (note that it's not being executed as part of a web request).</p>
  
  <p>The <code>memory_limit</code> in the server's "php.ini" file is set to "512M", and I have verified this as follows:</p>
  
  <pre><code># echo "&lt;?php phpinfo(); ?&gt;" | php | grep memory_limit
  memory_limit =&gt; 512M =&gt; 512M
  </code></pre>
  
  <p>Now, the issue is that when I execute the script in question via <code>php script.php</code>, eventually I get the following error:</p>
  
  <blockquote>
    <p>Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 600283 bytes) in ...</p>
  </blockquote>
  
  <p>268435456 bytes ~= 268mb, which is definitely lower than 512mb</p>
  
  <p>What could be happening here? Is it possible there is another system-level setting I am missing? Or are php processes intrinsically limited to ~ 268mb?</p>