Practical guides and instructions for common tasks using OPcache Toolkit.
Preloading ensures that your code is compiled into the OPcache memory before it's actually requested, improving initial page load times.
- Navigate to Settings > OPcache Toolkit (or Network Admin > OPcache Toolkit).
- Click on the Preload tab.
- Click the Run Preload Now button.
- The plugin will recursively compile all
.phpfiles in the WordPress core, plugins, and themes directories.
To preload a specific directory (e.g., a specific plugin):
wp opcache-toolkit preload /path/to/wordpress/wp-content/plugins/your-pluginUse this if you have manually changed PHP files and the changes are not showing up, or if the cache hit rate drops significantly.
- Navigate to Settings > OPcache Toolkit.
- Go to the Advanced tab.
- Click Reset OPcache Now.
wp opcache-toolkit resetOPcache Toolkit provides several commands for command-line monitoring.
- Check General Status:
wp opcache-toolkit info
- Run Health Diagnostics:
wp opcache-toolkit doctor
- Export Data as JSON:
wp opcache-toolkit info --json
OPcache Toolkit maintains structured logs for troubleshooting.
Logs are stored in the WordPress uploads directory:
wp-content/uploads/opcache-toolkit-logs/plugin.log
Each entry is formatted as JSON-like structure with metadata:
- Timestamp: When the event occurred.
- Level: The severity (INFO, WARNING, ERROR, DEBUG).
- Source: Whether the log came from PHP or JavaScript (REST API).
- Context: Additional data (e.g., file paths, memory usage, user ID).
If you need more detailed logs (including stack traces):
- Navigate to the Settings page.
- In the General tab, scroll to the bottom.
- Enable Debug Mode.
- Remember to disable it once troubleshooting is complete to save disk space.
- Cause: The PHP
opcacheextension is missing or disabled inphp.ini. - Solution: Ensure
zend_extension=opcacheis present in your PHP configuration andopcache.enable=1is set.
- Cause: The
opcache.memory_consumptionlimit may be too low for your site's size. - Solution: Check the Advanced > Debug Information section for your current limit and increase it in
php.iniif necessary.
- Cause: JavaScript files might be blocked, or the REST API is restricted.
- Solution: Check the browser console for errors and ensure that the
opcache-toolkit/v1REST namespace is accessible.