cancel
Showing results for 
Search instead for 
Did you mean: 

Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

SOLVED

Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

I'm trying to switch Deploy mode Developer to Production but after running the command " php bin/magento deploy:mode:set production" , Console showing the error for "Fatal error: Allowed memory size of 134217728 bytes exhausted".

I do not want to make any change in php.ini file for this issue.

Please suggest some solution if anyone can help me.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

Hello @tarunkumar081 

 

Try to run this command:
php -dmemory_limit=-1 bin/magento deploy:mode:set production
If you still get the same error, then you need to increase memory_limit on the server.
 
I hope it helps.
 
Thank you.
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

View solution in original post

4 REPLIES 4

Re: Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

Hello @tarunkumar081 

 

Try to run this command:
php -dmemory_limit=-1 bin/magento deploy:mode:set production
If you still get the same error, then you need to increase memory_limit on the server.
 
I hope it helps.
 
Thank you.
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

@tarunkumar081,

php.ini for CLI and browser are different. 

you can update the php.ini for CLI only that will not apply to browsers

check with the following command Loaded Configuration Files command line 

 

php --ini

in my server its 

 

/etc/php/7.2/cli/php.ini 

 you can update the memory_limit to 4G here 

memory_limit = 4G

and run the command Smiley Happy 

 

else you can just run the command with memory_limit as a parameter with -d

 

php -d memory_limit=4G bin/magento deploy:mode:set production


kindly accept as a solution if this works for you and give Kudos 

Re: Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

@amitsamsukha I've tried this command "php -d memory_limit=4G bin/magento deploy:mode:set production" But It didn't work over there. I think I would have to update the php.ini file for the same. 

  

Re: Memory limit Issue in Magento 2.2.1 - Unable to switch to production mode in

Try to run this command in your terminal ;

php -dmemory_limit=-1 bin/magento deploy:mode:set production

 you can use any value if you know how much memory it required or -1 if  it have no memory limit.