0

i have run production command but not working

php bin/magento deploy:mode:set production

enter image description here

when I run deploy command

php bin/magento setup:static-content:deploy -f

and Below type Error showing

Command returned non-zero exit code: `/opt/alt/php71/usr/bin/php -f

When i run Below deploy command and working Fine but i can not set to production mode

php bin/magento setup:static-content:deploy

enter image description here

  • I was facing similar issue today I had resolved it let me post answer for you – Hassan Ali Shahzad Sep 25 at 19:34
  • @HassanAliShahzad Thanks for replay please update your answer here – Rakesh Donga Sep 25 at 19:39
1
+50

Run below command in sequence for move website to production mode.

sudo chmod -R 0777 pub var generated
sudo php bin/magento setup:upgrade
sudo php bin/magento deploy:mode:set production -s
sudo php bin/magento setup:di:compile
sudo chmod -R 0777 pub var generated
sudo php bin/magento setup:static-content:deploy -f
sudo chmod -R 0777 pub var generated
sudo php bin/magento cache:flush
sudo chmod -R 0777 pub var generated

Note : Remove sudo if you have not access for root user

  • Thanks for replay ok let me try this it and update you – Rakesh Donga Oct 1 at 10:08
  • should be bin/magento setup:static-content:deploy -f. – HoangHieu Oct 15 at 10:07
3

First run the following command:

php bin/magento deploy:mode:set production -s

After that you can run following in sequence:

sudo rm -rf  var/cache/* var/page_cache/* generated/*
sudo chmod -R 777 var/ generated/ pub/static/ app/etc/ pub/media/
sudo php bin/magento setup:upgrade
sudo chmod -R 777 var/ generated/ pub/static/ app/etc/ pub/media/
php  -d memory_limit=5G bin/magento setup:static-content:deploy
sudo chmod -R 777 var/ generated/ pub/static/ app/etc/ pub/media/
php -d memory_limit=5G bin/magento setup:di:compile
sudo chmod -R 777 var/ generated/ pub/static/ app/etc/ pub/media/

Let me know if still have same issue?

  • your command working but compilation command not working 14 % complete after stop it and process finished it prnt.sc/payubz – Rakesh Donga Sep 25 at 19:52
  • you are not using my command copy my compilation command exactly – Hassan Ali Shahzad Sep 25 at 19:54
  • Also run in same sequence exactly copy & paste – Hassan Ali Shahzad Sep 25 at 19:55
  • i have same command as per your suggestion but not woking also production mode not set – Rakesh Donga Sep 25 at 19:58
  • can you show me print screen again please? – Hassan Ali Shahzad Sep 25 at 20:00
0

Remove theme folders from pub/static after setting to production mode

rm -rf pub/static/frontend/

and then run

php -dmemory_limit=6G bin/magento setup:static-content:deploy -f

OR

php -dmemory_limit=6G bin/magento setup:static-content:deploy 

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.