This assertion helps you to quickly identify if a PHP Ini value has a certain value.


This type checks that the expected value is being used in the PHP ini settings.

    - name: "Memory Limit is unlimited"
      setting: "memory_limit"
      value: "-1"

Not Expecting

Use this type to ensure that the value is something else than the provided expected value.

    - name: "Memory Limit is not unlimited"
      setting: "memory_limit"
      not_value: "-1"

Expecting OR with Operators

Use this to test against a list of possible values. You can also use it with 1 condition, if you just want to use the operators.

The operator = is based on simple string values. The operators <, <=, >, >= are obviously only possible for INT or FLOAT values. SVRUnit will automatically extract the values and compare thoses based on a float value. It also supports a correct conversion of units like KB, MB, GB and more out of the box for you.

  - name: "Verify PHP 7.1 or >= 7.4 is used"
    setting: "PHP_VERSION"
      - "operator": "="
        "value": "7.1"
      - "operator": ">="
        "value": "7.4"

PHP INI for "CLI" vs. "WEB"

As you know, PHP settings can either be configured when used with CLI, or when used for a HTTP web server like Apache.

The "PHP INI" Test module allows you to set a mode to "cli" or "web". This makes sure that you really test what you think you are testing.

The mode "cli" will simply check the requested INI setting using a CLI command.

The mode "web" will do a little bit more for you. It will search for your Apache DocRoot directory. When found, it places a temporary PHP script that will then be fetched with curl on your localhost. This makes sure to verify the real used INI setting of your web server. Afterwards this temporary PHP script is deleted again.

  - name: "Memory Limit is >= 512M"
    setting: "memory_limit"
    mode: "web"
      - "operator": ">="
        "value": "512M"

Please keep in mind, the mode "web" is pretty new. If you figure out any problems or missing features, just let us know, or do a pull request :) Thank you!

Last updated