> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Changing the PHP memory limit for scripts

> Discover how to adjust PHP script memory limits using the memory_limit directive in php.ini with our step-by-step guide and helpful links.

This article describes how to change the PHP memory limit for scripts by using the **memory\_limit** directive in a *php.ini* file.

<Warning>
  **Important**

  The information in this article only applies to certain types of hosting accounts. To determine whether or not the information below applies to your account, please see [this article](/docs/changing-php-settings-and-versions).

  📘 Note

  This article assumes that you have already set up a custom *php.ini* file on your web site. If you have not already set up a custom *php.ini* file, please read [this article](/docs/custom-php-ini-files) first.
</Warning>

## Using the memory\_limit directive

By default, a PHP script can allocate up to 128 megabytes of memory.

To change this limit, use a text editor to modify the **memory\_limit** directive in your *php.ini* file. For example, to allow scripts to allocate a maximum amount of 256 megabytes of memory, use the following setting:

```
memory_limit = 256M
```

<Tip>
  To verify the current value of the **memory\_limit** directive and other directives, you can use the **phpinfo()** function. For more information, please see [this article](/docs/view-php-settings).
</Tip>

## More information

* To view a complete list of *php.ini* directives, please visit [http://www.php.net/manual/en/ini.list.php](http://www.php.net/manual/en/ini.list.php).

* For more information about the **memory\_limit** directive, please visit [http://www.php.net/manual/en/ini.core.php#ini.memory-limit](http://www.php.net/manual/en/ini.core.php#ini.memory-limit).

## Related articles

* [Custom php.ini files](/docs/custom-php-ini-files)

* [Using php.ini directives](/docs/using-php-ini-directives)
