Checkup
Checkup is a feature to make it easier to assess server requirements and optimal configurations.
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 an private host. Related files:
-
system/
-
Controllers/
- HomeController.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 and suggestions
| Type | Message |
|---|---|
| Error | PHP[version] is more than [age] years old — upgrading to a newer version is strongly recommended for security and performance reasons |
| Warning | PHP[version] has not received updates for over [age] years — consider applying the latest security patches or upgrading to a newer release |
| Warning | The ini_get function is disabled, so no further checks can be performed |
| Warning | php.ini is not configured or could not be located on this server |
| Warning | The php_ini_loaded_file() is disabled, so no further checks can be performed |
| Warning | Disable magic_quotes_gpc |
| Warning | Set -1 to always_populate_raw_post_data |
| Warning | auto_detect_line_endings is deprecated as of PHP 8.1.0 |
| Warning | ./storage directory requires write permissions |
| Warning | (Optional) Intl extension is required by Inphinit\Utility\String and Inphinit\Utility\Url |
Possible errors and suggestions that may appear in the production mode:
| Type | Message |
|---|---|
| Error | In production environment, the display_errors must be disabled |
Possible errors and suggestions that may appear in the development mode:
| Type | Message |
|---|---|
| Warning | While in development mode, it is recommended to disable opcache.enable |
| Warning | While in development mode, it is recommended to disable wincache.ocenabled |
| Warning | While in development mode, it is recommended to disable xcache.cacher |