Its my first project in magento. I am confuse about deployment and compilation. When i do compilation every time after changes i got some error. Also deployment have many more time memory failed and execution error.

I m using these steps after every changes.

    sudo rm -rf var/di var/generation/ var/cache and var/page_cache   pub/static/frontend pub/static/_requirejs/ pub/static/adminhtml
    sudo chmod -R 777 var pub lib app/etc
    php   -dmemory_limit=2G  -dmaximum_execution_time=1800 bin/magento setup:upgrade 
    php   -dmemory_limit=2G   bin/magento indexer:reindex
    php   -dmemory_limit=2G  -dmaximum_execution_time=1800 bin/magento deploy:mode:set production -s
    php   -dmemory_limit=2G  -dmaximum_execution_time=1800 bin/magento setup:di:compile
    #php -d allowedmax_execution_time=3000  bin/magento setup:static-content:deploy
    php -f  bin/magento setup:static-content:deploy

But in deployment and comilation its failed every time due to memeory and execution error.

My question is when compilation and deployment required in magento 2 .


Compilation and deployment required in Magento 2 only when you need run it in "production mode". But if you develop module you need to switch to "developer mode" and static content will be automatically redeployed on request (but you need to cleanup pub/static only first time after switch)

As documentation says:

You should run the Magento software in production mode when it’s deployed to a production server.

  • but if compilation is broken in development mode, then it will be the same problem when it comes to compilation on production environment, and then it would need to be fixed anyways? Do I get it correctly? – Alex Shchur Nov 18 '16 at 17:55

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.