Nexcess Logo

Edit PHP files — .user.ini, nexinfo.php, and php.ini files

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
June 23, 2023

When PHP first came out in 1995, the abbreviation stood for Personal Home Page (PHP), but it later evolved in meaning. Regardless of what PHP stands for, it remains one of the most popular scripting languages used to run websites across the internet.

Any application using the Hypertext Preprocessor (PHP) platform in its programming language uses the php.ini file as its default configuration file. If done correctly, admin users can edit PHP files to change system variables such as file timeouts, resource limits, and upload sizes — among other variables found in the existing PHP settings files.

About when a Nexcess customer wants to edit PHP files

At Nexcess hosting, we do not allow clients to perform edits to php.ini files directly. However, our support team may implement php.ini file changes on your behalf.

Understanding how PHP file are managed at Nexcess

With those details and policies well understood, all Nexcess clients who want to edit PHP files should thoroughly read the following three related articles:

  1. What are the php.ini default values set for Nexcess customers?
  2. Modifying the PHP memory limit on cloud hosting plans
  3. Overriding php.ini timeout values with your PHP script's execution time limit

About the nature of our highly scalable and optimized website resources at Nexcess

Our clients can use the managed WordPress, managed WooCommerce, managed Magento, and flexible cloud hosting plans to manage their websites and online stores.

All of these web hosting plans are highly scalable and have optimized resources. A common infrastructure component in the application stack is PHP. In this article, we will take a deep dive into editing the configuration files associated with the PHP engine that powers your web hosting ecosystem.

Getting starting when you need to edit PHP files

Sometimes, scripts running on your websites may require more resources than what is available by default. We will show you how to modify the PHP settings file or files as necessary to ensure your websites function correctly. This kind of modification involves your capability to edit PHP files.

Nexcess default PHP limits

Per website hosted with us, PHP settings file’s default limits are set high enough on all cloud hosting plans to ensure normal website functionality works as expected. Nexcess uses the following standard PHP configuration:

  • max_execution_time 600
  • max_file_uploads 1024M
  • max_input_vars 16384
  • memory_limit 2048M
  • post_max_size 1536M
  • upload_max_filesize 1536M

About shorthand byte values in PHP

Some PHP directives may also take on shorthand byte values instead of int byte values. So, people often want to know the available shorthand options for byte values in PHP.

The available options are K for kilobytes, M for megabytes, and G for gigabytes — and they are all case-insensitive. Check the resources below to learn more:

- PHP Manual: Using PHP - Manual

- PHP Manual: Description of core php.ini directives - Manual

As discussed in the "Avoiding gigabyte, megabyte, and kilobyte value formatting issues" section of the What are the php.ini default values set for Nexcess customers? article, your syntax used to represent byte values when you edit PHP files must be precise to avoid the following kinds of issues others have encountered:

"There is no error message given if you accidentally use KB, MB, or GB instead of K, M, or G. From what I can tell the alphabetic characters will be ignored and it will be treated as bytes, so 1GB actually is treated as 1 byte. Furthermore, phpinfo() and ini_get() will report what you have written 1GB, so it will not be clear that there is anything wrong with your setting even though there is." ~ robjbrain in 2017

Creating a phpinfo file to output the PHP limits currently configured

It is important to note that the PHP information files created by following the guidance in this section should always be removed and not left on the server after testing.

You can check PHP limits used on your site simply by creating a phpinfo file named nexinfo.php within the document root directory on your site. It only requires one snippet of code within the file to call on the phpinfo() function, and you can add it by running a simple command from your site’s document root directory:

echo "<?php phpinfo(); ?>" >> nexinfo.php

You can then access the phpinfo page through your main domain (for example, However, sometimes, the Content Management System (CMS) you use will prevent file creation or limit access to the PHP info page.

If those circumstances occur, we strongly advise that you delete the nexinfo.php file and get in touch with our technical team so that we can verify the exact limit values for you. After reviewing this particular PHP settings file, we kindly advise that you permanently delete the phpinfo file (for example, the nexinfo.php file you just created in the steps above) from your site.

Edit PHP files to modify PHP limits for WordPress-based websites

Remember, Nexcess customers cannot modify the php.ini file themselves, but it can be modified with help from the Nexcess Technical Support Team. Contact our team via a phone call, chat session, or help ticket using the Nexcess Panel inside the Nexcess Client Portal.

Very rarely will WordPress websites hosted by our cloud-based product plans require more resources than those allocated by the Nexcess default PHP limits. However, sometimes your website's WordPress dashboard might display values different from the defaults. In those cases, we strongly advise you to create a nexinfo.php file to determine the current limits by visiting the nexinfo.php page, as previously explained.

If your WordPress website goes down unexpectedly with the "fatal error" message, it may have reached its memory limit. When this happens, the following text is shown in the PHP error log or WordPress debug log:

Fatal error: Allowed memory size of 157286400 bytes exhausted (tried to allocate 5775295 bytes)

To fix the error, you can modify WordPress’s PHP setting file limits in numerous locations. Changing them in the .htaccess file on Nexcess servers is not recommended because it can cause additional issues. The next sections will cover a safe way to modify PHP setting files.

Adjusting PHP limits via the wp-config.php PHP settings file

Before modifying the PHP limits in the wp-config.php file, create a backup of the original file. Then, add directives like the following:

define('WP_MEMORY_LIMIT', '128M');

Note that for sites running WooCommerce, we recommend setting the PHP memory limit to at least 256M.

You should be done once you save the file. If you're still getting the fatal error message, you may need to increase it further. To increase the admin area's memory limit, you'll need to add a directive similar to this:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Edit PHP files to modify PHP limits for Magento-based websites

You can modify PHP limits for Magento in the .user.ini and .htaccess files.

Adjusting PHP limits via the .htaccess and .user.ini PHP settings files

Both of these may be included in the website's document root directory. Multiple .htaccess and .user.ini files may exist in various directories within the Magento installation. You should use the lowest applicable restrictions here, and caution is always advised because the directions within them may conflict with one another.

Modifying PHP limits in general

The "edit PHP files" process can be accomplished in a number of ways, as discussed in the Nexcess php.ini default values article:

Making a .user.ini file in the website's document root is another approach to changing the PHP restrictions on any website hosted on a Nexcess server.

The html directory serves as the document root for most hosted websites. The pub directory or the domain-named directory will serve as the document root for Magento sites.

The .user.ini file's directives should be slightly modified to reflect the following values (or larger values):

- memory_limit = 128M

- max_execution_time = 3600

- max_input_vars = 20000

The PHP Manual contains additional details on these directives for editing PHP files. Please note that on Nexcess servers, it is not advised to modify the PHP restrictions using .htaccess files.

About websites hosted on Nexcess servers

Nexcess plans for Managed Cloud, WordPress, and WooCommerce hosting are scalable, and even in multi-tenant environments, the sites can perform well. To help with performance, the RAM allocated to each plan is not fixed, and those can change based on the site’s resource needs. Furthermore, our memory limits for PHP are set high and allow abundant resource capacity for normal functionalities of most sites.

A solid WordPress ecosystem that's always up to meet your performance standards

Web vitals stay on point with custom tuning and PHP workers. Utilize Redis, Object Cache Pro, and our innovative stack at no extra cost.

Scalable hosting architecture at Nexcess also includes unlimited email accounts, free daily backups, a 30-day money-back guarantee, an excellent customer care team ready to help with any issues that might arise along the way, an extensive Nexcess hosting and Nexcess Client Portal guide, the Nexcess Knowledge Base, and the Nexcess Web Hosting Blog.

Note about the original publication date

This article was originally published in September 2019. It has since been updated for accuracy and comprehensiveness.

Dylan Kramer
We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.