I've tried to install Magento 2 locally using XAMPP. This works fine, except for the fact that when I alter my CSS, HTML or JS, XAMPP won't get the updated files. It just takes the file I initially created with it's content, but not the updated version.
I think this has something to do with caching of Apache itself? I read something about disable cache using .htaccess (http://httpd.apache.org/docs/2.0/mod/mod_cache.html) but I can't figure out how to implement this.
Anyone knows how I can fix this?
Flushing cache doesn't work. Deploy static content may work, but I don't want to do that every time I make one minor change in the CSS (when I worked remotely, I did not have to do that either)
I think this problem is not Magento related, but rather something with XAMPP (probably Apache).
I have developer mode enabled.
Press Ctrl-F5 to hard refresh the page (to not use Browser's cache).
If you still see the previous pages or changes, then Apache has
mod_cache caching them, or PHP has its opcode cache settings set to
not refresh changes for X amount of time.
Taken from Xampp and Ampps don't reload files when changed
If mod_cache that is causing the problem then this might help you implement the fix How to disable cache of Apache?
This is not a caching issue, but rather the deploy mode you're using.
You are probably in default mode, in which case you will have to deploy static content every time, however you can switch to developer mode.
https://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-mode.html
This will stop magento having the need to generate the static content as it's done on the fly via the use of symlinks etc.
bin/magento deploy:mode:set developer
Or alternatively you can manually set this inside
app/etc/env.php
If developer mode isn't working it's more than likely down to permissions etc
Delete all files inside pub/static apart from the htaccess file, and make sure it's writable
In developer mode, M2 does not generate static files. It should create symlinks to them from the various modules. If you however have ran setup:static-content:deploy and have those files in place, it won't update them. Try to delete only those files inside pub/static folder on which you've worked and see if Magento links to them. If you delete all contents of pub/static/ folder, pages will take very long to load in browser.
Related
I'm using valet+ and Wordpress 5.9 on a local environment.
I have a simple task of updating some new terms of my payment module.
They are located under wp-content/plugins/my-plugin/languages/my-plugin.* where * represents .pot and -pt_BR.mo and -pt_BR.po files.
Some old terms are still working in the admin, even if I remove everything in this folder and refresh the page. The new terms are not being translated at all.
I already tried to restart valet (php, nginx, etc), and also used wp-cli cache flush command.
Am I missing something here? Or is there any other place to look for translation cache that I am leaving behind?
It turned out that wordpress was loading another file located under wpcontent/languages/plugin/my-plugin.*.
Removing those files solved the problem. No cache cleaning or restart was needed on local environment.
There is an old site on Symfony2.
I edited one of the twig-files.
The content of the page remains the same.
I tried:
Cleared app/cache folder.
Restarted apache server.
Reloaded browser with Ctrl+F5.
How to "rebuild" the site after editing twig files?
The fastest way for Symfony2 then would be:
rm -rf app/cache/*
However, make sure that app/cache is writable. Otherwise you'll have 500's with it not being able to write to cache anymore. You could also get specific with your environments like app/cache/dev or app/cache/prod. The next time your app loads it will take a bit more time, so if you are running a time-sensitive application (hopefully not with Symfony2) then plan that change accordingly.
The problem was that I haven't noticed that the site are hosted from a virtual machine. Thus, files in the standard location were ignored.
Since about three weeks changes on .phtml files have no effect on our productive magento installation. Therefore the same changes take effect on our test installation which is essentially a copy of it. Changes are made on the test installation. Thereby I'm following the Template Path Hints. Of course we are using our own template like: /app/design/frontend/venedor/mod/ We don't modify core, base or default-files. After everything looks fine the changes are transfered to production. Changes are uploaded successfully and downloading again shows the changes. Have doublechecked the Template Path Hints in production, too. Cache has been cleared about a thousand times.
The same with .php files. But changes in .csv files in /app/design/frontend/venedor/mod/locale/ take effect.
We are running Magento CE 1.9.2.1 on:
Linux 2.6.32-openvz-042stab084.17-amd64 (no root-access, no more information)
nginx 1.9.3
PHP 5.3.27 +PHP-FPM
Google PageSpeed is available but disabled
I have absolutely no clue about this behavior... Maybe some kind of caching effect of nginx or PHP-FPM? Any idea or what kind of information I should add?
Try appending ?abc=def to the url to see if the page changes. If it does then you know it's caching issue. Do you have Varnish cache on your server?
I am working on a moodle based project, which I inherited from someone else. Having copied the files into htdocs folder and started MAMP, the files still don't show in the browser. Instead, the browser automatically initiates a download. I might be required to change the config file, however, since I do not have much experience with php and SQL I am not sure what exactly. My part of the project is to develop html and css, but need to be able to run it locally first.
What do I need to do to get the files run locally? The route I use is localhost:8888/whatever/whatever/index.php
In case someone else runs into the same problem - Apache downloads php files instead of reading them - here is what helped me.
.htaccess file may need changes if the application has changed servers.
Delete (at least rename if you don't want to remove it) config.php and run the application through the browser. It should initiate install automatically.
To run php and SQL I used MAMP.
Let's say you have a big web app with large visits, but you don't want your app to crash & you don't want people to see the php or mysql errors that happens during replacing files using FTP, How to avoid that? How to just execute the old version of file until the replacing is done?
Thanks
you can follow at least one of this 2 rules:
to use accelerators (like APC) with turned off mtime checking. so until you clear cache manually - old versions will be used from memory
to use virtualhost symlinked to directory with your project: let's examine you store yout project at /home/project/www. and /home/project/public_html is your real webroot and symlinked to www. so - create /home/project/www2, checkout files there, setup and do whatever you want. after this - just change symlink.
I use git to upload my changes to a staging website on the same server, after testing I then push it to the production website. None of the files are changed until they are all received. On the plus side, it only sends the changes compressed, so I don't even have to send an entire file.
The staging area isn't required. I work with a lot of servers and sometimes some of the specific configurations on that server (mostly just find that an extension isn't installed)/
I'm sure you can do the same with another version control system. You need to be careful though. The tutorial I linked specifically stores the git information OUTSIDE the document root. Otherwise someone can just clone all the source code for your website.
If you like SVN, the .svn being in every directory can be a little annoying. Make sure that people can't download what they shouldn't be able to.
Deploy your app into the temporary directory. Then after you done, just rename the original app directory to app.old and the directory where you deployed your files into app
Note this should work okay in Unix environments. Also this will only work if all of the above directories are on the same file systems. In rare case users might see 404 error if they happen to access the app after your renamed the original app into .old and before you renamed temp dir into the original app directory.