Many guides I read state just running setup:upgrade or clearing the cache will result in changes to modules being made apparent, but if I just clear the cache it doesn't help, even if I delete all the files in the var/generation and var/page_cache and var/di and var/cache folders and run magento cache:clean. Running magento setup:upgrade break the site, no js or css is there at all unless I rerun setup:di:compile and setup:static-content:deploy yet the site is in development mode with caching disabled, so why do I have to re compile and re deploy for every change to a module? It seems broken :( Especially as all these guides say just setup:upgrade or cache:clean should show my changes, which I'm not understanding why need run if I'm in development mode with cache disabled? Any help greatly appreciated, waiting to redeploy for any change I want to see is very time consuming.
-
1Yeah, extremely time consuming. Setup grunt on your local to compile your LESS. You can use the standard way when deploying to server. I wrote a script for those commands on my server, and use Grunt on local. My 2 cents. devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/…– camdixonOct 5, 2016 at 17:36
2 Answers
setup:upgrade :
If you enabled one or more modules, then you will need to run magento setup:upgrade to update the database schema.
Setup:upgrade :
it not require run on every changes in module.
cache:clean :
if it enable from admin then you have to clean after any changes in code, but if it disable from admin then no need to run cache:clean command.
When we run setup:upgrade command after that we have to deploy static content, else no need to deploy static content.
-
I made a change to a phtml file, and nothing I do will make the change show have tried: setup:upgrade cache:clean setup:di:compile setup:static-content:deploy I have tried following the docs: devdocs.magento.com/guides/v2.0/config-guide/cli/… under set to developer mode as well as the advice on this page: devdocs.magento.com/guides/v2.0/config-guide/cli/… My last change I messed with stuff for 40 mins to get it to show, please help.– user44406Oct 5, 2016 at 18:11
-
1if you have modify phtml code then you have to run php bin/magento cache:clean and check your changes. Oct 5, 2016 at 18:15
-
I ran that, and there are no changes, it's still showing old text that isn't even in any file on the server. I verified it is in developer mode and caching is disabled. Browser cache is also disabled. I also had to change env.php before and the only way to get it to change was delete the file and run magento till I got an error, then put the modified file back in.– user44406Oct 5, 2016 at 18:24
-
Also accept my answer if you have really use for resolve issue. Oct 5, 2016 at 18:38
I found an answer finally. My server uses php-fpm and there was something weird with it not setting developer mode properly this page helped me: How do I set Developer Mode in Magento 2
As did the people on this page so upvoted them :) The post that helped me the most was setting developer mode in the php-fpm pool. I also have to restart php-fpm service on each change but it then shows up immediately, even if I don't run cache:clean. So I'll need to fix something with php-fpm but this is not a magento issue and you guys helped me so thank you.
To further this, to fix it totally I had to set these in a php.ini file for me this was in /etc/php.d/10-opcache.ini
opcache.enable = 0
opcache.enable_cli = 0
and for the environment variable in /etc/php-fpm.d/www.conf
env[MAGE_MODE] = developer
Then restarting php-fpm
service php-fpm restart
And my changes to phtml files show up immediately now.