Skip to content

Commit 00101b4

Browse files
committed
feat: additional opcache setting in check PHP.ini
1 parent aef9e37 commit 00101b4

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

system/Security/CheckPhpIni.php

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,30 @@ private static function outputForWeb(array $output, array $thead, array $tbody):
118118
public static function checkIni(): array
119119
{
120120
$items = [
121-
'error_reporting' => ['recommended' => '5111'],
122-
'display_errors' => ['recommended' => '0'],
123-
'display_startup_errors' => ['recommended' => '0'],
124-
'log_errors' => [],
125-
'error_log' => [],
126-
'default_charset' => ['recommended' => 'UTF-8'],
127-
'memory_limit' => ['remark' => '> post_max_size'],
128-
'post_max_size' => ['remark' => '> upload_max_filesize'],
129-
'upload_max_filesize' => ['remark' => '< post_max_size'],
130-
'request_order' => ['recommended' => 'GP'],
131-
'variables_order' => ['recommended' => 'GPCS'],
132-
'date.timezone' => ['recommended' => 'UTC'],
133-
'mbstring.language' => ['recommended' => 'neutral'],
134-
'opcache.enable' => ['recommended' => '1'],
135-
'opcache.enable_cli' => [],
136-
'opcache.jit' => [],
137-
'opcache.jit_buffer_size' => [],
121+
'error_reporting' => ['recommended' => '5111'],
122+
'display_errors' => ['recommended' => '0'],
123+
'display_startup_errors' => ['recommended' => '0'],
124+
'log_errors' => [],
125+
'error_log' => [],
126+
'default_charset' => ['recommended' => 'UTF-8'],
127+
'memory_limit' => ['remark' => '> post_max_size'],
128+
'post_max_size' => ['remark' => '> upload_max_filesize'],
129+
'upload_max_filesize' => ['remark' => '< post_max_size'],
130+
'request_order' => ['recommended' => 'GP'],
131+
'variables_order' => ['recommended' => 'GPCS'],
132+
'date.timezone' => ['recommended' => 'UTC'],
133+
'mbstring.language' => ['recommended' => 'neutral'],
134+
'opcache.enable' => ['recommended' => '1'],
135+
'opcache.enable_cli' => [],
136+
'opcache.jit' => [],
137+
'opcache.jit_buffer_size' => [],
138+
'opcache.memory_consumption' => ['recommended' => '728', 'remark' => 'Increasing the configured memory size (MB) will improve performance by caching those files'],
139+
'opcache.interned_strings_buffer' => ['recommended' => '64'],
140+
'opcache.max_accelerated_files' => ['recommended' => '56000', 'remark' => 'Increasing the configured accelerated will many cache files into OPCache hash table'],
141+
'opcache.max_wasted_percentage' => ['recommended' => '15'],
142+
'opcache.validate_timestamps' => ['recommended' => '0'],
143+
'opcache.revalidate_freq' => ['recommended' => '0'],
144+
'opcache.save_comments' => ['recommended' => '1'],
138145
];
139146

140147
$output = [];

tests/system/Security/CheckPhpIniTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ public function testCheckIni(): void
3737
$this->assertSame($expected, $output['display_errors']);
3838
}
3939

40+
public function testCheckIniOpcache(): void
41+
{
42+
$output = CheckPhpIni::checkIni();
43+
44+
$expected = [
45+
'global' => '',
46+
'current' => '1',
47+
'recommended' => '1',
48+
'remark' => '',
49+
];
50+
$this->assertSame($expected, $output['opcache.save_comments']);
51+
}
52+
4053
public function testRunCli(): void
4154
{
4255
// Set MockInputOutput to CLI.

0 commit comments

Comments
 (0)