Skip to content

feat: add spark command to check php.ini #8581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 2, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Feb 25, 2024

Description
To easily check important php.ini settings.

$ php spark phpini:check

CodeIgniter v4.4.6 Command Line Tool - Server Time: 2024-02-25 01:23:22 UTC+00:00

+-------------------------+---------+---------+-------------+-----------------------+
| Directive               | Global  | Current | Recommended | Remark                |
+-------------------------+---------+---------+-------------+-----------------------+
| error_reporting         | 32767   | 32767   | 5111        |                       |
| display_errors          | 1       | 1       | 0           |                       |
| display_startup_errors  | 1       | 1       | 0           |                       |
| log_errors              | 1       | 1       |             |                       |
| error_log               |         |         |             |                       |
| default_charset         | UTF-8   | UTF-8   | UTF-8       |                       |
| memory_limit            | 1G      | 1G      |             | > post_max_size       |
| post_max_size           | 8M      | 8M      |             | > upload_max_filesize |
| upload_max_filesize     | 2M      | 2M      |             | < post_max_size       |
| request_order           | GP      | GP      | GP          |                       |
| variables_order         | GPCS    | GPCS    | GPCS        |                       |
| date.timezone           | UTC     | UTC     | UTC         |                       |
| mbstring.language       | neutral | neutral | neutral     |                       |
| opcache.enable          | 1       | 1       | 1           |                       |
| opcache.enable_cli      | 0       | 0       |             |                       |
| opcache.jit             | tracing | tracing |             |                       |
| opcache.jit_buffer_size | 0       | 0       |             |                       |
+-------------------------+---------+---------+-------------+-----------------------+

Via Web:

<?php

namespace App\Controllers;

use CodeIgniter\Security\CheckPhpIni;

class Home extends BaseController
{
    public function index(): string
    {
        return CheckPhpIni::run(false);
    }
}

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added enhancement PRs that improve existing functionalities docs needed Pull requests needing documentation write-ups and/or revisions. 4.5 labels Feb 25, 2024
@kenjis kenjis marked this pull request as draft February 25, 2024 01:39
@kenjis kenjis force-pushed the feat-spark-phpini-check branch 3 times, most recently from 2ce9b0d to 564c463 Compare February 25, 2024 01:56
@kenjis kenjis marked this pull request as ready for review February 25, 2024 01:57
@kenjis kenjis force-pushed the feat-spark-phpini-check branch from 564c463 to c54ca68 Compare February 25, 2024 02:03
Copy link
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why it is necessary to have this command in CI4. Do we have such a command or class in similar php framework?

@kenjis
Copy link
Member Author

kenjis commented Feb 26, 2024

Because PHP ini settings change the behaviors of PHP.
So every dev should know the current settings.

But there is no way to check them easily.
phpinfo() gives us too many information.

@kenjis kenjis force-pushed the feat-spark-phpini-check branch from c54ca68 to ebda766 Compare February 27, 2024 03:06
@kenjis kenjis removed the docs needed Pull requests needing documentation write-ups and/or revisions. label Feb 27, 2024
@kenjis
Copy link
Member Author

kenjis commented Feb 27, 2024

Added opcache settings and user guide.

@kenjis kenjis merged commit 4658167 into codeigniter4:4.5 Mar 2, 2024
@kenjis kenjis deleted the feat-spark-phpini-check branch March 2, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that improve existing functionalities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants