Reviewing and updating PHP settings

Overview

PHP settings are reviewed and updated by uploading two files to your site: a phpinfo script to see the settings that are currently in effect, and a .user.ini file to change them.

A .user.ini file does not take effect the moment you upload it. You have to recycle the site in the Control Panel before the new values are used.

Step 1: Check which PHP version the site is running

  1. Log in to the Everleap Control Panel at cp.everleap.com.
  2. From the top menu click Shared Sites.
  3. On the Shared Cloud Sites Overview page, click Manage next to the applicable site.
  4. On the Site Overview page, click the SETTINGS tab.
  5. Click the General tab and look at the PHP dropdown.
Site Settings General tab showing the ASP.NET Framework dropdown and the PHP dropdown with its version list expanded

If PHP is set to Disabled, see How to enable PHP first.

Step 2: Review the current settings with phpinfo

phpinfo is used to display the current PHP configuration for the site and server. Specific parameters can be passed to customize the output, or to display all information the following syntax can be used:

<?php phpinfo(); ?>

Add that syntax to a PHP file, upload it to the site and view it in a browser. An example script is also included in the .zip in the Sample section below.

In the output, the Local Value column is what your site is using and the Master Value column is the server default. When you change a setting successfully, only the Local Value changes.

Step 3: Change a setting with .user.ini

A site's PHP settings can be adjusted by creating a .user.ini file, adding the appropriate syntax, then uploading that file to the document root of the site by FTP.

A common update is post_max_size and upload_max_filesize, often changed to allow plugin and theme uploads through WordPress. On a site running PHP 7.4 these default to 8M and 2M respectively, which can lead to upload errors within WordPress.

To increase both to 60 MB, create a new text document containing:

post_max_size = 60M
upload_max_filesize = 60M

Save it as .user.ini and upload it to the document root of the site (/site/wwwroot).

Step 4: Recycle the site

The new values are not used until the site is recycled.

  1. In the Control Panel, go back to the Site Overview page for the site (Shared Sites, then Manage).
  2. In the Site Tools panel, click Recycle.
The Site Tools panel on the Site Overview page, showing Site: On with the Stop Site and Recycle buttons

Verify it worked

Reload your phpinfo page. The Local Value should now show the setting from your .user.ini, while the Master Value stays at the server default.

phpinfo output on PHP 7.0.18 showing post_max_size and upload_max_filesize with a Local Value of 60M against a Master Value of 8M

This example was captured on a site running PHP 7.0.18, where the server default for upload_max_filesize was 8M rather than the 2M shown on PHP 7.4. The server default varies by PHP version, so the figure in your own Master Value column may differ. What matters is that the Local Value now shows the setting from your .user.ini.

If the Local Value has not changed, check that:

  • the file is named exactly .user.ini, including the leading dot;
  • it is in the document root of the site, not in a subdirectory;
  • you clicked Recycle after uploading it.

Sample

For an example phpinfo script and .user.ini file, download phpSettings.zip.

Notes

  • Not every PHP directive can be set from .user.ini. Directives that PHP only reads at startup cannot be overridden this way, and they will keep showing the Master Value no matter how many times you recycle.
  • Delete the phpinfo script when you are finished. It publishes detailed information about your site's configuration to anyone who finds the URL.
  • More detail on phpinfo itself is in the PHP manual.

Related Articles