Checkup
Inphinit features a tool that assists in diagnosing the environment, identifying potential issues or suggesting optimal configurations—such as those aimed at enhancing security or performance.
Using
It is possible to use the class to detect problems in the environment where the application is running, like this:
<?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);
});
When creating a new project, the /checkup in main.php route will already be configured and working to determine the conditions of the environment in which the application is running. It's possible to move the route to a context with authentication or limit it to the scope of a private host. Related files:
-
system/
-
Controllers/
- CheckupController.php
-
views/
- checkup.php
-
Controllers/
These files can be removed or completely recreated; the approach presented is just a sample of basic usage.
Possible errors
| Message | Notes |
|---|---|
Unexpected value in max_execution_time=<value> (interpreted as <value>) |
Note: Web only |
Unlimited max_execution_time is unsafe in Web context |
Note: Web only |
Invalid value in entry memory_limit=<value> |
|
Unlimited memory_limit is unsafe in Web context |
Note: Web only |
Invalid value in entry post_max_size=<value> |
Note: Web only |
Invalid value in entry upload_max_filesize=<value> |
Note: Web only |
post_max_size=<value> is smaller than upload_max_filesize=<value> |
Note: Web only |
Unexpected value in max_file_uploads=<value> (interpreted as <value>) |
Note: Web only |
random_bytes() unavailable, enable the Mcrypt Extension to use as fallback |
Note: PHP 5 Only |
random_bytes() unavailable; check disable_functions |
Note: PHP 7+ Only |
No such directory: ./storage |
|
./storage directory requires write permissions |
|
Disable the deprecated magic_quotes_gpc |
Note: PHP 5 & 7 only |
Disable the deprecated always_populate_raw_post_data |
Note: PHP 5 only |
In production environment, the display_errors must be disabled |
Note: Production Environment Only |
Possible warnings
| Message | Notes |
|---|---|
memory_limit=<value> may not be enough |
|
post_max_size=<value> may not be enough |
Note: Web only |
upload_max_filesize=<value> may not be enough |
Note: Web only |
max_file_uploads=<value> may not be enough |
Note: Web only |
file_uploads=Off is disabled. If this is not intentional enable it |
Note: Web only |
random_bytes() unavailable. Using Mcrypt Extension as fallback |
Note: PHP 5 Only |
(Optional) Intl Extension is required by Inphinit\Utility\String and Inphinit\Utility\Url |
|
Disable the deprecated auto_detect_line_endings |
|
While in development mode, it is recommended to disable opcache.enable |
Note: Development Environment Only |
While in development mode, it is recommended to disable wincache.ocenabled |
Note: Development Environment Only |
While in development mode, it is recommended to disable xcache.cacher |
Note: Development Environment Only |
Set expose_php=Off to ensure the PHP version is not exposed through HTTP headers |
Note: Web only |
The ini_get function is disabled, so no further checks can be performed |
|
php_ini_loaded_file() is disabled, so some checks may be skipped |
|
php.ini is not configured; Ignore this if you are using flags |