---
title: "Modifying the PHP memory limit on cloud hosting plans"
source: "https://docs.nexcess.com/sites-stores/managed-woocommerce/store-management/php-memory-limits/"
description: "Here you’ll learn how to modify PHP memory limits on cloud hosting plans at Nexcess to ensure the functionality of your websites can run without errors."
vertical: "Sites & Stores"
date: "2023-06-21"
last_modified: "2026-07-02"
---

# Modifying the PHP memory limit on cloud hosting plans

## Modifying the PHP memory limit on cloud hosting plans

Sometimes the scripts your websites are running will need additional resources compared to what’s already available to them by default. Here you’ll learn how to modify PHP memory limits to ensure the functionality of your websites can run without errors.

## PHP memory management

Every site hosted on a Nexcess plan already has [**PHP memory limits**](https://docs.nexcess.com/sites-stores/managed-woocommerce/store-management/php-default-values/) set high enough to allow it to function normally. The following common PHP values are set as follows:

- **max\_execution\_time 600**
- **max\_file\_uploads 1024M**
- **max\_input\_vars 16384**
- **memory\_limit 2048M**
- **post\_max\_size 1536M**
- **upload\_max\_filesize 1536M**

Shorthand Byte Values

As is well-documented in the following article, the M shown above represents megabytes and to avoid issues, the proper shorthand byte values of K, M, and G must be used appropriately when setting a PHP memory limit:  
[**What are the php.ini default values Set for Nexcess customers?**](https://www.nexcess.net/help/php-ini-default/)  
So, a few PHP directives may also take on shorthand byte values, as opposed to only **int** byte values. People often want to know what the available shorthand options for byte values in PHP are. The available options are K for kilobytes, M for megabytes, and G for gigabytes — and they are all case-insensitive:  
**[PHP: Using PHP – Manual](https://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes)**  
[PHP: Description of core php.ini directives – Manual](https://www.php.net/manual/en/ini.core.php)

### Checking PHP limits including PHP memory limits

You can check the PHP limits set for your site by creating a **nexinfo.php** file within the document root directory of your website. Running this command when you’re in the site’s document root directory will allow you to check them:

```
<strong>echo"" >> nexinfo.php</strong>
```

The information page can be accessed through your main domain, like **https://example.com/nexinfo.php**.

Please always delete this file after you’ve checked the information you need.

## About the PHP settings file

The primary way to modify the PHP memory limits on any type of website hosted on a Nexcess server is to create the PHP settings file. The file used for PHP memory management will need to be called the **.user.ini** file and located within the document root of the website.

The document root directory for most websites is the **html** directory. The document root for Magento sites will be either the **pub** directory or the domain-named directory.

The directives within the .user.ini file will need to be similar to the following:

> **memory\_limit = 128M**  
> **max\_execution\_time = 3600**  
> **max\_input\_vars = 20000**

More information about these directives can be found in the [**PHP manual**](https://www.php.net/manual/en/ini.list.php). Using **.htaccess** files to modify PHP limits — including the PHP memory limit — is not advisable on Nexcess servers.

## Modifying PHP limits for WordPress-based websites

WordPress websites hosted on the Nexcess Cloud plans or within Managed WordPress/WooCommerce plans will rarely need more resources than allocated to them by default PHP limits. However, occasionally, your website’s WordPress dashboard might show different values than the default ones. In that case, we’d recommend creating the **nexinfo.php** file, as you’ll be able to confirm the actual limits by visiting the **nexinfo.php** page, as previously explained.

However, if your website suddenly goes down with the **“Critical Error”** message, there could be a memory limit. If that happens, you should see an error message similar to the following within the PHP error log or the WordPress debug log:

> ```
> <strong>Fatal error: Allowed memory size of 157286400 bytes exhausted (tried to allocate 5775295 bytes)</strong>
> ```

WordPress is specific in the way that the PHP limits can be modified in multiple locations. On Nexcess servers, it is not recommended to modify these limits in the **.htaccess** file, as it can cause further issues.

### Modifying PHP limits via the wp-config.php file

Should you wish to modify the PHP limits using the **wp-config.php** file, you’ll need to create a backup of the initial file and add directives similar to the following:

> ```
> <strong>define('WP_MEMORY_LIMIT', '128M');</strong>
> ```

Once you save the file, you should be done. However, if you’re still getting the fatal error with mentions of a memory limit, you might need to increase it further.

Should you want to increase the memory limit for the admin area, you’ll need to add a directive similar to the following:

> ```
> <strong>define( 'WP_MAX_MEMORY_LIMIT', '256M' );</strong>
> ```

## Modifying PHP limits for Magento-based websites

PHP limits for Magento — including the PHP memory limit — can be modified within the **.htaccess** file, as well as the **.user.ini** file. Both of these can be added to the document root directory of the website. There can be multiple **.htaccess** and **.user.ini** files within various directories of the Magento installation. Caution is always advised here, as the directives within them can contradict one another, and the lowest limits will be applicable.

## Conclusion

Nexcess Cloud, Managed WordPress, and Managed WooCommerce plans are scalable plans — that even in multi-tenant environments — allow the sites to perform resource-heavy tasks. The amount of RAM allocated to each plan is not fixed, as it varies depending on the site’s need for resources. PHP memory limits are set initially high and allow for standard functionalities of most sites.

## Related articles

- [**What are the php.ini default values set for Nexcess customers?**](https://docs.nexcess.com/sites-stores/managed-woocommerce/store-management/php-default-values/)
- [**Overriding php.ini timeout values with your PHP script’s execution time limit**](https://docs.nexcess.com/sites-stores/server-administration/linux/apache-web-server/controlling-php-settings-with-a-custom-php-ini-file/)
- ****[How to edit php.ini](https://docs.nexcess.com/sites-stores/managed-woocommerce/store-management/modify-php-values/)****
