<p>Sounds like you don't have the correct PHP loading in your CLI. You should try <a href="https://craftcms.com/guides/mamp-with-composer-and-mysql-on-the-command-line#using-mAMPs-php-executable-in-terminal" rel="nofollow noreferrer">using MAMP’s PHP Executable in your Terminal</a>.</p>

CC BY-SA 4.0
2020-01-24T11:58:37.137Z
Thanks for the suggestion @Oli, but I've already done this. .bash_profile has `export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.3.3/bin:${PATH}"` set already
Seraphim Jester
CC BY-SA 4.0
2020-01-22T10:59:39.183Z
2020-01-22T10:59:39.183Z
Oli
<h2>Problem</h2>
<p>Hi all, I have been struggling with issuing the command <code>./craft gc</code>. It shows the following</p>
<pre><code>Delete all trashed items? (yes|no) [no]:yes
Running garbage collection ... PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes)'
</code></pre>
<p>the allowed memory size equates to 128MB. I attempted to increase the limit but it still showed the 128M <code>Allowed memory size</code>.</p>
<h2>What I've Done</h2>
<ul>
<li>I have set <code>'phpMaxMemoryLimit' =&gt; '1024M'</code> in <code>config/general.php</code></li>
<li>I have set <code>memory_limit = 1024M</code> in the <code>php.ini</code></li>
<li>I executed the command <code>php --ini |grep &quot;Loaded Configuration File&quot;</code> which showed the correct path</li>
<li>I made a <code>webroot/phpfile</code> with <code>&lt;?php phpinfo();</code> which showed both the correct path, and correct <code>memory_limit</code></li>
<li>I checked <code>admin/utilities/php-info</code> which showed the correct <code>memory_limit</code></li>
</ul>
<h2>Information</h2>
<ul>
<li>PHP version   7.3.3</li>
<li>OS version    Darwin 19.2.0</li>
<li>Craft edition &amp; version   Craft Pro 3.3.19</li>
<li>Mamp PRO version 5.3</li>
</ul>

<craft3><mamp><memory><cli>
Memory Upgrade Issues
# Memory Upgrade Issues

(Asked by: username_0 on 2020-01-10)

Problem
Hi all, I have been struggling with issuing the command ./craft gc. It shows the following
Delete all trashed items? (yes|no) [no]:yes
Running garbage collection ... PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes)'

the allowed memory size equates to 128MB. I attempted to increase the limit but it still showed the 128M Allowed memory size.
What I've Done

I have set 'phpMaxMemoryLimit' => '1024M' in config/general.php
I have set memory_limit = 1024M in the php.ini
I executed the command php --ini |grep "Loaded Configuration File" which showed the correct path
I made a webroot/phpfile with  which showed both the correct path, and correct memory_limit
I checked admin/utilities/php-info which showed the correct memory_limit

Information

PHP version   7.3.3
OS version    Darwin 19.2.0
Craft edition & version   Craft Pro 3.3.19
Mamp PRO version 5.3

**Tags:** craft3, mamp, memory, cli


---

## 1 answers

### Answer by username_1 on 2020-01-22. Score: 1

Sounds like you don't have the correct PHP loading in your CLI. You should try [using MAMP’s PHP Executable in your Terminal](https://craftcms.com/guides/mamp-with-composer-and-mysql-on-the-command-line#using-mAMPs-php-executable-in-terminal).

> **Comments:**
> **username_0**: Thanks for the suggestion @username_1, but I've already done this. .bash_profile has `export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.3.3/bin:${PATH}"` set already  

---

