Oihana PHP System

initMemoryLimit.php

Table of Contents

Functions

initMemoryLimit()  : bool
Initialize the default memory limit of the PHP application.

Functions

initMemoryLimit()

Initialize the default memory limit of the PHP application.

initMemoryLimit(string|null $memoryLimit[, string $defaultMemoryLimit = "128M" ]) : bool

This function sets the PHP memory_limit ini directive to the given value if provided, otherwise it uses the provided default memory limit.

Parameters
$memoryLimit : string|null

The memory limit value to set (e.g. '256M', '1G', or '-1' for unlimited), or null to use default.

$defaultMemoryLimit : string = "128M"

The default memory limit to use if $memoryLimit is null. Default is '128M'.

Tags
throws
ConstantException
example
// Sets memory_limit to 256M
initMemoryLimit('256M');

// Uses the default value (128M)
initMemoryLimit(null);
Return values
bool

True if the ini setting was successfully set, false otherwise.


        
On this page

Search results