PHP OPcache wont budge and how to insert the opcache GUI?

Hello there.

Nextcloud 30.0.5 tells me to increase the opcache.interned_strings_buffer within a php.ini

I located a php.ini and made the change from 8 to 64 :muscle::

/etc/php/8.2/fpm/php.ini

Restarted php:

systemctl restart php8.2-fpm

Restarted the server. No change.

< >

Followed the documentation into downloading the opcache GUI.

Went into the directory:

cd /var/www/html/

Downloaded the magical index.php

wget -O pleasework.php githublink/index.php

Changed permissions. Restarting everything. Visited server-IP/pleasework.php

Debian stock install with Apache2. What is going on?

Are you sure you’re using FPM? It is not the default. You may be using mod_php with Apache instead.

There are config files for each run mode in /etc/php.

1 Like

Yes there is another php.ini

$ php -i

Configuration File (php.ini) Path => /etc/php/8.2/cli
Loaded Configuration File => /etc/php/8.2/cli/php.ini
cd /etc/php ls
8.2

cd /etc/php/8.2 ls
cli   fpm   mods-available

There is a php.ini in both cli and fpm.
I edit opcache.interned_strings_buffer in both.

$ systemctl restart php8.2-fpm
#Services mod_php or php8.2 are not found.
$ reboot

No change… I feel a bit stupid here. Could you point me further?

Hi @LeHarry,

Could you please copy and paste this code in your terminal and post the output here:

pv=8.2
env PHP_INI_SCAN_DIR=/etc/php/$pv/fpm/conf.d/ LC_MESSAGES=C php-fpm$pv -c /etc/php/$pv/fpm/php.ini -d "error_reporting='~E_ALL'"  -i  | grep -E '^[^A-Z].*=>.*=>' | sort | php$pv -r '
            $lines = file("php://stdin", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            foreach ($lines as $line) {
                list($directive, $local, $master) = array_map("trim", explode("=>", $line));
                $value = $local === "On" ? 1 : ($local === "Off" ? 0 : ($local === "no value" ? "" : $local));
                echo "$directive=$value\n";
            }
        ' | grep opcache

EDIT: Sorry, I initially had the wrong PHP version (pv=8.3) in the code, hopefully you noticed that.


ernolf

1 Like

Hi ernolf! :slight_smile:

pv=8.2
env PHP_INI_SCAN_DIR=/etc/php/$pv/fpm/conf.d/ LC_MESSAGES=C php-fpm$pv -c /etc/php/$pv/fpm/php.ini -d "error_reporting='~E_ALL'"  -i  | grep -E '^[^A-Z].*=>.*=>' | sort | php$pv -r '
            $lines = file("php://stdin", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            foreach ($lines as $line) {
                list($directive, $local, $master) = array_map("trim", explode("=>", $line));
                $value = $local === "On" ? 1 : ($local === "Off" ? 0 : ($local === "no value" ? "" : $local));
                echo "$directive=$value\n";
            }
        ' | grep opcache
env: „php-fpm8.2“: File or Directory not found

The server documentation lists following entries to PHP:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install apache2 php8.2-fpm

What is your distribution?

grep -h PRETTY_NAME /etc/os-release /usr/lib/os-release | cut -d= -f2 | sort -u

What is your path?

echo $PATH

ernolf

1 Like

Debian GNU/Linux 12 stock / up-to-date

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

OK, whith that path it cannot work.

Here the code:

pv=8.2
env PHP_INI_SCAN_DIR=/etc/php/$pv/fpm/conf.d/ LC_MESSAGES=C /usr/sbin/php-fpm$pv -c /etc/php/$pv/fpm/php.ini -d "error_reporting='~E_ALL'"  -i  | grep -E '^[^A-Z].*=>.*=>' | sort | php$pv -r '
            $lines = file("php://stdin", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            foreach ($lines as $line) {
                list($directive, $local, $master) = array_map("trim", explode("=>", $line));
                $value = $local === "On" ? 1 : ($local === "Off" ? 0 : ($local === "no value" ? "" : $local));
                echo "$directive=$value\n";
            }
        ' | grep opcache

Much and good luck,
ernolf

1 Like

input:

pv=8.2
env PHP_INI_SCAN_DIR=/etc/php/$pv/fpm/conf.d/ LC_MESSAGES=C /usr/sbin/php-fpm$pv -c /etc/php/$pv/fpm/php.ini -d "error_reporting='~E_ALL'"  -i  | grep -E '^[^A-Z].*=>.*=>' | sort | php$pv -r '
            $lines = file("php://stdin", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            foreach ($lines as $line) {
                list($directive, $local, $master) = array_map("trim", explode("=>", $line));
                $value = $local === "On" ? 1 : ($local === "Off" ? 0 : ($local === "no value" ? "" : $local));
                echo "$directive=$value\n";
            }
        ' | grep opcache

response:

opcache.blacklist_filename=
opcache.consistency_checks=0
opcache.dups_fix=0
opcache.enable_cli=0
opcache.enable_file_override=0
opcache.enable=1
opcache.error_log=
opcache.file_cache_consistency_checks=1
opcache.file_cache=
opcache.file_cache_only=0
opcache.file_update_protection=2
opcache.force_restart_timeout=180
opcache.huge_code_pages=0
opcache.interned_strings_buffer=8
opcache.jit_bisect_limit=0
opcache.jit_blacklist_root_trace=16
opcache.jit_blacklist_side_trace=8
opcache.jit_buffer_size=0
opcache.jit_debug=0
opcache.jit_hot_func=127
opcache.jit_hot_loop=64
opcache.jit_hot_return=8
opcache.jit_hot_side_exit=8
opcache.jit_max_exit_counters=8192
opcache.jit_max_loop_unrolls=8
opcache.jit_max_polymorphic_calls=2
opcache.jit_max_recursive_calls=2
opcache.jit_max_recursive_returns=2
opcache.jit_max_root_traces=1024
opcache.jit_max_side_traces=128
opcache.jit=
opcache.jit_prof_threshold=0.005
opcache.lockfile_path=/tmp
opcache.log_verbosity_level=1
opcache.max_accelerated_files=10000
opcache.max_file_size=0
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.opt_debug_level=0
opcache.optimization_level=0x7FFEBFFF
opcache.preferred_memory_model=
opcache.preload=
opcache.preload_user=
opcache.protect_memory=0
opcache.record_warnings=0
opcache.restrict_api=
opcache.revalidate_freq=2
opcache.revalidate_path=0
opcache.save_comments=1
opcache.use_cwd=1
opcache.validate_permission=0
opcache.validate_root=0
opcache.validate_timestamps=1

Hi @LeHarry

That is the default of 8MB

You either entered the value in a wrong syntax or you misspelled it

h.t.h.


ernolf

1 Like

// checking for errors now
readout

sudo nano /etc/php/8.2/fpm/php.ini
[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0

; The OPcache shared memory storage size.
;opcache.memory_consumption=256

; The amount of memory for interned strings in Mbytes.
;opcache.interned_strings_buffer=64

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
;opcache.max_accelerated_files=50000
sudo nano /etc/php/8.2/cli/php.ini
[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=1

### ; Determines if Zend OPCache is enabled for the CLI version of PHP
### ;opcache.enable_cli=0

; The OPcache shared memory storage size.
;opcache.memory_consumption=256

; The amount of memory for interned strings in Mbytes.
;opcache.interned_strings_buffer=64

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
;opcache.max_accelerated_files=50000

Zend OPCache seems to be disabled for the CLI version of PHP

; any text on a line after an unquoted semicolon (;) is ignored

read this:

in other words: You did not uncomment the line:

opcache.interned_strings_buffer=64

ernolf

3 Likes

Thank you alot ernolf, that was quite the rookiemistake. I am glad you are here! :muscle: :100:

2 Likes