cancel
Showing results for 
Search instead for 
Did you mean: 

Allowed memory size of 2097152 bytes exhausted.

SOLVED
Highlighted

Allowed memory size of 2097152 bytes exhausted.

Hello.

I changed the memory_limit to 4096MB:

memory_limit = 4096MB

 But when I run below command:

# ./magento setup:store-config:set --base-url="http://127.0.0.1:1338"

IT show me an error:

PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 147456 bytes) in /var/www/html/vendor/magento/module-cms-graph-ql/registration.php on line 10

How can I solve it?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

Can you try once using inline memory:

php -d memory_limit=-1 bin/magento

View solution in original post

7 REPLIES 7
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

Hi ,

Add following line in index.php.
ini_set("memory_limit","-1");

If it will not work then you need to increase from the server and restart apache.

Or try command using installed php full path:

For example:
/usr/bin/php7.2 bin/magento

Please go through following url, it may help you.

https://magento.stackexchange.com/questions/167862/php-memory-limit
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

I changed physical memory to 6GB and added that line to "index.php" but problem not solved.

I did:

# /usr/bin/php72 magento setup:static-content:deploy -f
PHP Fatal error:  Allowed memory size of 2097152 bytes exhausted (tried to allocate 147456 bytes) in /var/www/html/vendor/magento/module-cms-graph-ql/registration.php on line 10

Any idea to solve it?

Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

Can you try once using inline memory:

php -d memory_limit=-1 bin/magento

View solution in original post

Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

The result is:

# php -d memory_limit=-1 magento setup:static-content:deploy -f

Deploy using quick strategy
frontend/Magento/blank/en_US            2245/2245           ============================ 100% %  4 secs              
adminhtml/Magento/backend/en_US         2328/2328           ============================ 100% %  2 secs              
frontend/Magento/luma/en_US             2260/2260           ============================ 100% %  3 secs

Execution time: 38.524020195007
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

It’s looks like static content deployment is completed without any error. 😊
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

Hi @jason_long,

If it work then please accept as a solution so it will help to others as well.
Highlighted

Re: Allowed memory size of 2097152 bytes exhausted.

Add the next code to bin/magento just after the <?php tag:

ini_set("memory_limit","-1");

You're welcome