<?php
/*
Plugin Name: OPCache Memory Checker
Description: This plugin checks the configuration of opcache and displays how much memory is allocated to it.
Version: 1.0
Author: Your Name
*/
function check_opcache_memory() {
$memory = ini_get('opcache.memory_consumption');
return $memory;
}
add_action('admin_menu', 'opcache_memory_menu');
function opcache_memory_menu() {
add_menu_page(
'OPCache Memory',
'OPCache Memory',
'manage_options',
'opcache-memory',
'opcache_memory_page',
'dashicons-performance',
75
);
}
function opcache_memory_page() {
$memory = check_opcache_memory();
echo '<h1>OPCache Memory</h1>';
echo '<p>Memory allocated to OPCache: '.$memory.'MB</p>';
}
<?php
/*
Plugin Name: OPCache Memory Checker
Description: This plugin checks the configuration of opcache and displays how much memory is allocated to it.
Version: 1.0
Author: Your Name
*/
function check_opcache_memory() {
$memory = ini_get('opcache.memory_consumption');
return $memory;
}
add_action('admin_menu', 'opcache_memory_menu');
function opcache_memory_menu() {
add_menu_page(
'OPCache Memory',
'OPCache Memory',
'manage_options',
'opcache-memory',
'opcache_memory_page',
'dashicons-performance',
75
);
}
function opcache_memory_page() {
$memory = check_opcache_memory();
echo '<h
function opcache_memory_page() {
$memory = check_opcache_memory();
echo '<h1>OPCache Memory</h1>';
echo '<p>Memory allocated to OPCache: '.$memory.'MB</p>';
if (isset($_POST['submit'])) {
update_option('opcache_memory_consumption', $_POST['opcache_memory_consumption']);
$memory = check_opcache_memory();
}
echo '<form method="post">';
echo '<label>Memory Consumption:</label>';
echo '<input type="number" name="opcache_memory_consumption" value="'.$memory.'">';
echo '<input type="submit" name="submit" value="Save">';
echo '</form>';
}