Skip to main content

withPHPIniValues

Callable

  • withPHPIniValues(php: UniversalPHP, phpIniValues: Record<string, string>, callback: () => Promise<any>): Promise<any>

  • Sets php.ini values to the given values, executes a callback, and restores the original php.ini values. This is useful for running code with temporary php.ini values, such as when disabling network-related PHP functions just to run WordPress installer.

    @example
        await withPHPIniValues(
    php,
    {
    disable_functions: 'fsockopen',
    allow_url_fopen: '0',
    },
    async () => await runWpInstallationWizard(php, {
    options: {},
    })
    );
    ```

    Parameters

    • php: UniversalPHP

      The PHP instance.

    • phpIniValues: Record<string, string>

      The php.ini values to set.

    • callback: () => Promise<any>

      The callback to execute.

    Returns Promise<any>

    The result of the callback.