Shopware: Plugin install on CLI works, but admin removes it again!?


Today I had a weird behaviour of one of our customers store. We tried to install the Shopware Security Plugin and what happened was:

  1. I install the security plugin via composer
  2. I refresh the plugins via CLI -> plugin is in CLI and database
  3. I activate and install the plugin -> plugin is installed in CLI and database
  4. I update the plugin list on the admin area -> the plugin is deleted from database and gone in CLI

TL;DR: Opcache.

I turned to Shopware’s slack and asked the community. We had this behaviour in the past, but I couldn’t remember what the problem was.

Thankfully I got an answer <3

I think I had this problem once as well. Have you cleared OpCache? If I remember correctly, that did the trick for me

Johannes Przymusinski [die-lobby.de]

Thanks Johannes!

Reset opcache

I know two ways to reset opcache:

  1. Restart PHP-fpm
  2. or using the awesome cachetool by gordalina!

4 thoughts on “Shopware: Plugin install on CLI works, but admin removes it again!?

  1. If you talk about a production system, activating the opcache is a good idea. Watch the option `opcache.validate_timestamps = 0` – that’s the one actually causing your troubles.

    However, on a production system, it is not a recommended practice to install plugins manually. Rather use CI/CD with composer.

    On staging and dev systems you may want to deactivate opcache in general or at least set `opcache.validate_timestamps = 1`.

      1. tl;dr Just set `opcache.validate_timestamps = 1` if you plan to install plugins/apps manually. The reason Admin seems to remove the plugin is that it just didn’t notice the new files in the custom/plugins/ folder because of caching.

Leave a Reply