Diagnóstico
O Inphinit conta com uma ferramenta que auxilia no diagnóstico do ambiente, identificando possíveis problemas ou sugerindo configurações ideais, como aquelas voltadas para o aprimoramento da segurança ou do desempenho.
Usando
É possível usar a classe para detectar problemas no ambiente em que o aplicativo está sendo executado, da seguinte forma:
<?php
use Inphinit\Diagnostics\Checkup;
$app->action('GET', '/checkup', function () {
$check = new Checkup();
$errors = $check->getErrors();
echo implode("<br>\n", $errors);
$warnings = $check->getWarnings();
echo implode("<br>\n", $warnings);
});
Ao criar um novo projeto, a rota /checkup já estará configurada em main.php e funcionando para determinar as condições do ambiente em que a aplicação será executada. É possível mover a rota para um contexto com autenticação, limitá-la ao escopo de um host privado. Arquivos relacionados:
-
system/
-
Controllers/
- CheckupController.php
-
views/
- checkup.php
-
Controllers/
Esses arquivos podem ser removidos ou completamente recriados; a abordagem apresentada é apenas um exemplo de uso básico.
Possíveis errors
| Mensagem | Condição |
|---|---|
| The PHP version is affected by CVE-2026-109618 and CVE-2026-109619. Upgrade PHP or look into temporary workarounds (or confirm that your distribution backported the fix) | PHP < 8.2.0 |
| The PHP version is affected by CVE-2026-109618 and CVE-2026-109619. Upgrade to 8.2.35 (or confirm that your distribution backported the fix) | PHP 8.2.x < 8.2.35 |
| The PHP version is affected by CVE-2026-109618 and CVE-2026-109619. Upgrade to 8.3.36 (or confirm that your distribution backported the fix) | PHP 8.3.x < 8.3.36 |
| The PHP version is affected by CVE-2026-109618 and CVE-2026-109619. Upgrade to 8.4.27 (or confirm that your distribution backported the fix) | PHP 8.4.x < 8.4.27 |
| The PHP version is affected by CVE-2026-109618 and CVE-2026-109619. Upgrade to 8.5.12 (or confirm that your distribution backported the fix) | PHP 8.5.x < 8.5.12 |
Unexpected value in max_execution_time={$entry} (interpreted as {$value}) |
max_execution_time não é um inteiro simples |
Unlimited max_execution_time is unsafe in WEB context |
Contexto HTTP e max_execution_time < 1 |
Invalid value in entry memory_limit={$entry} |
memory_limit tem um formato inválido |
Unlimited memory_limit is unsafe in WEB context |
Contexto HTTP, memory_limit ilimitado, PHP não vulnerável |
Invalid value in entry post_max_size={$post_max_size_entry} |
Contexto HTTP e post_max_size inválido |
Invalid value in entry upload_max_filesize={$upload_max_filesize_entry} |
Contexto HTTP, file_uploads habilitado, valor inválido |
post_max_size={$post_max_size_entry} is smaller than upload_max_filesize={$upload_max_filesize_entry} |
Contexto HTTP, file_uploads habilitado, post_max_size < upload_max_filesize |
Unexpected value in max_file_uploads={$max_file_uploads_entry} (interpreted as {$max_file_uploads}) |
Contexto HTTP, file_uploads habilitado, max_file_uploads não é um inteiro simples |
random_bytes() unavailable, enable the Mcrypt extension to use as fallback |
PHP < 7.0 sem mcrypt_create_iv |
random_bytes() unavailable; check disable_functions |
PHP>=7.0 sem random_bytes() |
No such directory: {$display} |
Diretório logs, session ou tmp ausente em storage |
{$display} directory requires write permissions |
Diretório logs, session ou tmp sem permissão de escrita |
Disable the deprecated magic_quotes_gpc |
PHP < 8.0 e magic_quotes_gpc habilitado |
Disable the deprecated always_populate_raw_post_data |
PHP < 7.0 e a entrada habilitada |
In production environment, the display_errors must be disabled |
Fora do modo de desenvolvimento e display_errors habilitado |
Disable the deprecated auto_detect_line_endings |
Entrada habilitada, PHP vulnerável e PHP>=8.1 (caso contrário, é um warning) |
Possíveis avisos
| Mensagem | Condição |
|---|---|
While PHP is not upgraded, set fatal_error_backtraces=0 and restart all workers (partial mitigation) |
PHP vulnerável, PHP>=8.5 e a entrada habilitada |
While PHP is not upgraded, set session.upload_progress.enabled=0 and restart all workers (partial mitigation) |
PHP vulnerável e a entrada habilitada |
filter.default={$filter} can emit a diagnostic before request startup (CVE-2026-109619); restore the default value |
PHP vulnerável, PHP>=8.1, extensão filter carregada, valor diferente de unsafe_raw |
report_memleaks=0 can emit a diagnostic before request startup (CVE-2026-109619); remove it |
PHP vulnerável, PHP>=8.5 e report_memleaks desabilitado |
intl.error_level can emit a diagnostic before request startup (CVE-2026-109619); restore the default value (0) |
PHP vulnerável, PHP>=8.5, extensão intl carregada e valor != 0 |
{$key}={$value} can emit a diagnostic before request startup (CVE-2026-109619); remove it (use default_charset) |
PHP vulnerável, extensões mbstring/iconv carregadas, e *.http_input, *.http_output, *.internal_encoding (ou iconv.input_encoding, iconv.output_encoding) definidos |
It is recommended to set max_execution_time between {$min_exec} and {$max_exec} in WEB context |
Contexto HTTP e valor fora de 30–300 |
Unlimited memory_limit is unsafe in WEB context; it is only acceptable as a partial mitigation until PHP is upgraded |
Contexto HTTP, memory_limit ilimitado, PHP vulnerável |
memory_limit={$entry} may not be enough |
memory_limit < 16 MB |
post_max_size={$post_max_size_entry} may not be enough |
Contexto HTTP e post_max_size < 1 MB |
post_max_size={$post_max_size_entry} is above the recommended cap while PHP is not upgraded (8M without uploads, 32M with uploads) |
Contexto HTTP, PHP vulnerável e post_max_size > 32 MB |
upload_max_filesize={$upload_max_filesize_entry} may not be enough |
Contexto HTTP, file_uploads habilitado e valor < 1 MB |
max_file_uploads={$max_file_uploads} may not be enough |
Contexto HTTP, file_uploads habilitado e max_file_uploads < 1 |
file_uploads is disabled (Off). If this is not intentional, enable it |
Contexto HTTP e file_uploads desabilitado |
random_bytes() unavailable. Using Mcrypt Extension as fallback |
PHP < 7.0 com mcrypt_create_iv disponível |
(Optional) Intl extension is required by Inphinit\Utility\String and Inphinit\Utility\Url |
Classe \Transliterator não disponível |
Disable the deprecated auto_detect_line_endings |
Entrada habilitada e não (PHP vulnerável e PHP>=8.1) |
While in development mode, it is recommended to disable opcache.enable |
Desenvolvimento, OPcache disponível e habilitado |
While in development mode, it is recommended to disable wincache.ocenabled |
Desenvolvimento, WinCache disponível e habilitado |
While in development mode, it is recommended to disable xcache.cacher |
Desenvolvimento, XCache disponível e habilitado |
Set expose_php=Off to ensure the PHP version is not exposed through HTTP headers (appends or PHP easter eggs if PHP < 5.5) |
Contexto HTTP e expose_php habilitado |
ini_get() is disabled, so no further checks can be performed |
ini_get() indisponível |
php_ini_loaded_file() is disabled, so some checks may be skipped |
php_ini_loaded_file() indisponível |
php.ini is not configured; Ignore this if you are using flags |
php_ini_loaded_file() retorna false |