> For the complete documentation index, see [llms.txt](https://docs.svrunit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.svrunit.com/assertions/php-ini.md).

# PHP INI

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

## Expecting

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

```yaml
php_ini:
    - 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.

```yaml
php_ini:
    - 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.

```yaml
php_ini:
  - name: "Verify PHP 7.1 or >= 7.4 is used"
    setting: "PHP_VERSION"
    value_or:
      - "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.

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

{% hint style="warning" %}
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!
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.svrunit.com/assertions/php-ini.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
