cancel
Showing results for 
Search instead for 
Did you mean: 

Weird memory limit - Unable to run compiler or switch to production mode

Weird memory limit - Unable to run compiler or switch to production mode

Magento Version : 2.3.0

I tried to change mode developer to production but after run command into CLI, it throw memory limit error as per mention below

 

"PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes)"

 

I also tried run following commands but still above error generated and stop command

sudo php -d memory_limit=16G bin/magento deploy:mode:set production
sudo php -d memory_limit=134217728 bin/magento deploy:mode:set production

Please suggest me, how can i fix it ?

Thanks in advance

3 REPLIES 3

Re: Weird memory limit - Unable to run compiler or switch to production mode

HI @yagnik_solanki 


Add following line in index.php.

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


Try to increase memory limit at least 4GB on the server.

or try following command:

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

 

 

Re: Weird memory limit - Unable to run compiler or switch to production mode

Hi Vimal,

 

Thanks for reply,

 

I already tried your solution but still same issue occurred.

 

can you please suggest another solution ?

Re: Weird memory limit - Unable to run compiler or switch to production mode

I have same issue.  Did you solve your issue?  If yes, how?  Thanks for your attention.