I have an error when i add module..

so i run below command but also display error that below when run command from root,

php magento setup:di:compile

enter image description here

How i fix it?

i already allow memory limit to 4G

enter image description here


You can try this way:

php -dmemory_limit=-1 bin/magento setup:di:compile


Edit PHP.ini settings, in this case is the memory_limit

memory_limit = 768M max_execution_time = 18000

change memory and execution time limit.

Hope it helps.

|improve this answer|||||

You can try running this command:

php -dmemory_limit=1024M bin/magento setup:di:compile

Sometime it occurs that the sufficient memory id not available for M2 command to execute.So we set the memory limit for it.

Hope it helps!

|improve this answer|||||
  • sir i am on window 10 not in linux etc – Muhammad Ahmed Mar 8 '19 at 10:56
  • 1
    In that case use this php -dmemory_limit=1024M bin/magento setup:di:compile..also did you restart your server after changing the memory limit? – surbhi agr Mar 8 '19 at 10:57
  • i need php -dmemory_limit=1024M this command everytime? – Muhammad Ahmed Mar 8 '19 at 10:59
  • did it work? yes when ever there is issue of memory you can use it. – surbhi agr Mar 8 '19 at 11:01
  • i don't want to use this comment every time but right now i needed.i want to get lifetime solution – Muhammad Ahmed Mar 8 '19 at 11:03

You need to find out which php.ini file your are loading first. run the following command to find your php.ini

php --ini

The output will show you where is the php.ini you are loading now, and locate the file and change the

memory_limit = 768M

max_execution_time = 18000

after that restart your httpd service.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.