PHP code example of amadeco / module-opcache-gui

1. Go to this page and download the library: Download amadeco/module-opcache-gui library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amadeco / module-opcache-gui example snippets


// Example preload.php for Magento 2
function preload($path) {
    static $loaded = 0;
    if ($loaded >= 500) return;
    
    if (is_file($path) && preg_match("/\.php$/", $path)) {
        opcache_compile_file($path);
        $loaded++;
    }
}

// Only preload essential core files
preload(__DIR__ . '/vendor/magento/framework/App/Bootstrap.php');
preload(__DIR__ . '/vendor/magento/framework/App/Http.php');
// Additional critical files...
ini
opcache.enable = 1
opcache.enable_cli = 0
opcache.memory_consumption = 1024
opcache.interned_strings_buffer = 128
opcache.max_accelerated_files = 60000
;
; Production Mode
;
opcache.validate_timestamps = 0
;
; Development Mode
;
;opcache.validate_timestamps = 1
;opcache.revalidate_freq = 10
;
opcache.save_comments = 1
opcache.enable_file_override = 0
ini
# /etc/php/8.1/fpm/pool.d/magento-frontend.conf
[magento-frontend]
user = www-data
listen = /var/run/php-fpm-magento-frontend.sock
pm = dynamic
pm.max_children = 120
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 35

# /etc/php/8.1/fpm/pool.d/magento-admin.conf
[magento-admin]
user = www-data
listen = /var/run/php-fpm-magento-admin.sock
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10
nginx
# Frontend requests
location ~ ^/(pub|static|media)/.*\.php$ {
    fastcgi_pass unix:/var/run/php-fpm-magento-frontend.sock;
    # Additional FastCGI settings...
}

# Admin requests
location ~ ^/admin {
    fastcgi_pass unix:/var/run/php-fpm-magento-admin.sock;
    # Additional FastCGI settings...
}