beyondcode / laravel-self-diagnosis

Perform Self-Diagnosis Tests On Your Laravel Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checker for php.ini options

akalongman opened this issue · comments

For my project I've implemented checker for php.ini options. Configuration looks like this:

\App\Libraries\SelfDiagnosis\Checks\PhpIniOptions::class                  => [
    'options' => [
        'upload_max_filesize' => '>=128M',
        'post_max_size'       => '>=128M',
        'memory_limit'        => '>=128M',
        'max_input_vars'      => '>=10000',
        'file_uploads'        => '1',
        'disable_functions'   => '',
    ],
],

If project owners will be interested, I can send PR

@mpociot any thoughts?

I would like to see this added.

There can be an issue of checking it, as the command will be run in cli, and for requests, fpm is used. But probably it is feasible, just less obvious to implement 🤷‍♂️

There can be an issue of checking it, as the command will be run in cli

I run it in HTTP via $kernel->call() from controller

@akalongman Can you please tell how are you using $kernel->call(). I cannot figure out how I use that with ini_get('max_execution_time') for example.

@sarfraznawaz2005 You have to run

$output = new BufferedOutput(
    OutputInterface::VERBOSITY_NORMAL,
    true,
);

$kernel->call('self-diagnosis', [], $output)

($kernel is Illuminate\Contracts\Console\Kernel)

@akalongman Thanks. As @alexsoft pointed out we should use http kernel instead of console kernel to get correct php ini value which is expected on web (http). So not sure how I can I get value for ini_get('max_execution_time') which comes from php.ini used for web not for console (a different php.ini file is used by server for cli).

@akalongman okay so this can return php.ini flags used for web/http: $values = parse_ini_file(php_ini_loaded_file());

Thanks