cancel
Showing results for 
Search instead for 
Did you mean: 

Allowed memory size of 2097152 bytes exhausted.

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

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

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

10 REPLIES 10

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

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?

Re: Allowed memory size of 2097152 bytes exhausted.

Can you try once using inline memory:

php -d memory_limit=-1 bin/magento

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

Re: Allowed memory size of 2097152 bytes exhausted.

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

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.

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

Re: Allowed memory size of 2097152 bytes exhausted.

php -d memory_limit=-1 bin/magento sampledata:deploy
php -d memory_limit=-1 bin/magento setup:upgrade

Re: Allowed memory size of 2097152 bytes exhausted.

Hi, 

 

This unfortunately did not work for me. 

I am new to Magento 2 and I have followed the setup here on my local:

 

But after I run

bin/magento setup:install \
--base-url=http://localhost/magento2ee \
--db-host=localhost \
--db-name=magento2 \
--db-user=patrick \
--db-password=Password.2022 \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=es-host.example.com \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15

I get this error in the terminal:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /Users/magento2/vendor/magento/module-config/Model/Config/Structure/Mapper/Path.php on line 49

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /Users/magento2/vendor/magento/module-config/Model/Config/Structure/Mapper/Path.php on line 49

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.%                         patricpatrpatricpapatrpatrpapapapapapapapapapapapapapapa

When I click into the file this is what the path.php file on line 49 this is what I see:

$elementConfig['path'] = $parentPath;

Screenshot 2022-08-10 at 21.03.53.png

 

I would really appreciate the help!