diff --git a/lib/SimpleSAML/Utils/System.php b/lib/SimpleSAML/Utils/System.php
index 689dcf08df0dd8b8c67c8d2a599b300ae9cad41b..ec8b8ba1a2d36c5825861c20e00a6938e7705c74 100644
--- a/lib/SimpleSAML/Utils/System.php
+++ b/lib/SimpleSAML/Utils/System.php
@@ -203,5 +203,9 @@ class System
                 'Error moving "'.$tmpFile.'" to "'.$filename.'": '.$error['message']
             );
         }
+
+        if (function_exists('opcache_invalidate')) {
+            opcache_invalidate($filename);
+        }
     }
 }