This module allows administrators to clear PHP APC and OPCache caches directly from the Drupal administration interface. It provides a simple, secure way to flush PHP memory and opcode caches, eliminating the need for server access or hosting support.
About
Clear PHP Caches allows administrators to clear PHP APC and OPCache caches from Drupal without requiring direct server access. This module provides a simple, secure administration interface for flushing PHP memory and opcode caches — eliminating the need to SSH into your server or contact hosting support.
Whether you're deploying code changes, troubleshooting performance issues, or managing a multi-server environment, Clear PHP Caches gives your team the tools to clear caches directly from the Drupal administration interface.
Features
- One-Click Cache Clearing — Clear PHP APC and OPCache with a single click from the admin toolbar
- Permission-Based Access Control — Restrict cache clearing to trusted administrators using Drupal's permission system
- Admin Toolbar Integration — Seamless integration with Admin Toolbar for quick access under the "Flush" menu
- Direct URL Access — Access the cache clearing function via /admin/flush/phpcaches for scripting and automation
- Success Feedback — Immediate confirmation message after caches are cleared
- Smart Redirects — Automatically returns you to the previous page after clearing
- Zero Configuration — Works immediately after installation with no setup required
Requirements
Drupal: 10 or 11
PHP: 8.1 or higher with APCu and OPCache extensions enabled
Dependencies:
- Admin Toolbar (optional, but recommended for menu integration)
Note: The module works without Admin Toolbar, but you'll need to access the cache clearing function via the direct URL at /admin/flush/phpcaches.
Getting Started
Installation:
composer require drupal/clearphpcachesEnable the module at Administration > Extend or via Drush:
drush en clearphpcachesFirst Steps:
- After enabling, navigate to Administration > People > Permissions
- Search for "Clear PHP Caches" and grant the permission to trusted administrator roles
- If Admin Toolbar is enabled, the "Clear APC and OPCache" item now appears under Flush in the admin toolbar
- Click the menu item or visit /admin/flush/phpcaches to clear caches
Use Cases:
- Immediately clear caches after deploying code changes
- Troubleshoot performance issues by flushing opcode caches
- Automate cache clearing in CI/CD pipelines via direct URL access
- Reduce hosting support tickets by empowering administrators to clear caches
- Manage multi-server environments without SSH access
Ask your assistant about Clear PHP Caches
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.