1. Home
  2. cPanel
  3. Configuring PHP Environment Variables

Configuring PHP Environment Variables

Your GreenGeeks hosting account includes the ability to customize PHP environment variables without the assistance of our technical support staff.

Today I’ll show you how to make changes to the PHP version and environment variables using our cPanel interface.

This tutorial uses the default cPanel Basic (or “paper_lantern”) theme. Other themes may not reflect what you see here.

How to Change the PHP Version

In order to customize your PHP settings, you must select a custom PHP version. You cannot change the PHP settings for the native (default) PHP version.

Log in to GreenGeeks and go to your cPanel account by clicking the “cPanel Login” button in the “Quick Server Login” section.

click to log in to cPanel

In the “Software” section, click the “Select PHP Version” link or icon.

cPanel select PHP version

Select the version you wish to use from the drop-down menu.

  • By default, the latest stable version (called the “native” version) will be selected and is already active. Remember, you can’t change the settings for the native PHP version, so if you wish to use the native version, further customization isn’t possible.
  • Also, while you have the option to select older versions of PHP, unless you have a specific need for an older version, we recommend using one of the latest major versions.

cPanel select PHP version

After choosing the version from the drop-down, click the “Set as current” link.

cPanel select PHP version - set as current

The version you select may not have any extensions selected. If that’s the case, and you want to enable the most commonly used extensions, click the “Reset to default” button.

click the "Reset to default" button

Then select any other extensions you wish to add. Your selections are automatically saved and loaded on the server.

select extensions you wish to add

The system will not allow you load conflicting extensions. For example, if the “pdo_mysql” extension is selected, you will not be able to select “nd_pdo_mysql.” You must deselect the conflicting extension – in this case, “pdo_mysql” – before you can select “nd_pdo_mysql.” It may not always be obvious where the conflict lies, so you may have to Google the extension you wish to add to find potential conflicts.

conflicting extensions

If you run into problems on your website after loading an extension, come back and click the “Reset to default” button for your PHP version.

How to Configure PHP Settings

To change PHP settings like memory limits and execution time, click the “Switch to PHP options” button.

cPanel select PHP-version - switch to PHP options

The PHP settings apply to the currently selected PHP version. If you change the PHP version, any settings changes you made here will not apply to the newly selected version.

To make changes, click the blue checkboxes, enter text into the text fields, or click a blue dropdown link. Any changes you make here will also be automatically saved.

cPanel PHP selector settings

Viewing the Changes

You can check to make sure your changes have been applied by creating a phpinfo.php file. Add the following line of code to a blank text file:

<? phpinfo(); ?>

Name the file phpinfo.php and upload it to the root directory of your site.

Visit http://ggexample.com/phpinfo.php to view the PHP settings (replacing ggexample.com with your domain name).

Was this article helpful?

Comments

  1. This article is lacking in detail and all attempts I’ve made at implementing a custom php.ini workaround have not worked. My current WordPress installation has a max file upload size of only 1MB and my php.ini in the root directory has a setting of 30MB.

    The article should be updated with a sample php.ini (complete).

  2. Hello Jeremiah,

    Thank you for your comments, modifying PHP.ini files has always been a difficult/confusing process. GreenGeeks is proud to announce, a new & easier way of managing your PHP.ini files directly from your cPanel account. Take a look at the updates and contact support if you have any further difficulties.

  3. Any attempts to use php 5.3 or 5.4 result in a configuration error on any php script I try to execute. Even with default settings and includes.

  4. Are you sure that your PHP scripts are coded to work correctly with 5.3 and 5.4? Check with the developer of the script. If your script is compatible, send in a ticket via the Account Manager and one of our technicians will look into this for you.

  5. Thank you for this article.
    It resolved my issue.

    I run a Denver cleaning service> and I administer the website also.

    I have a background in IT back end systems but I’m a novice on front end systems and web stuff.

    I love Green Geeks. They have provided me the best support ever.
    Support actually directed me to this link.

    I love that we have access to cPanel with the GUI admin tools.
    It makes life much easier for we who do not modify code files often.

  6. This functionality is only available on our Shared & Reseller hosting services. VPS servers are restricted to one PHP version (5.4 by default) and support the traditional php.ini functionality.

  7. Now that php 5.5 is “end of life” (no actively being supported and no security fixes after July 10, 2016, does GreenGeeks have a migration plan?

    Will you go to 5.6, or jump directly to 7?
    When are you planning to do this?

    P.S. It’s been almost three years since you updated this Knowledge Base item – maybe it’s time the article said that you’re on 5.5 and what your plans are.

  8. This have not help me yet… This error need a video to show how to change it

  9. So how do I set outside of the 2 or 3 suggested variables?

    For example: You encourage the installation of Moodle through Softaculous apps installer, however if I want to download all students work at once or even if serveral of them are uploading at once the max I can set “max_execution_time” to is a whopping 90 sec. Also know as internal server error 500 request timed out.

  10. Hey Josh,

    So it looks like you’re on 5.6 now, at least that’s what I’m seeing on PHP Selector. It says that changing options is impossible.

    I need to change the upload_max_filesize and the post_max_size settings. I need both to be 20MB. Any way this can be done?

    Thanks,
    Martin

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.