Change Your PHP Version - Dedicated and VPS Hosting
If you are using assistive technology and are unable to read any part of the HostMonster website, or otherwise have difficulties using the HostMonster website, please call 866-573-HOST and our customer service team will assist you.
Skip to main content

HostMonster Web Hosting Help

Change Your PHP Version - Dedicated and VPS Hosting

EasyApache 4 only

The following instructions are for servers running EasyApache 4. While that should apply in most cases, some older servers may still be running EasyApache 3. If you cannot access the Software » EasyApache 4 section in WHM, your server is still using EasyApache 3. Don't hesitate to get in touch with support for help in upgrading to EasyApache 4.



Overview

On our VPS and Dedicated hosting service, changing the PHP versions, loading custom Apache mods, and other Apache/PHP customizations are all performed in the Web Host Manager (WHM). Please follow the instructions below to change the PHP configuration and set the version used by a domain.

Configuration

Recommended values: While it may be tempting to set parameters like memory_limit and max_execution_time to very high values, this can have adverse effects, causing the server to run out of memory or lock up. This is especially the case on smaller servers with limited resources. Typically, most customers should not need a memory_limit higher than 384 MB or a max_execution_time greater than 30 seconds. If a script requires so many resources, it typically indicates an issue with the application.

  1. Log into your WHM.

    If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.

  2. Once in the WHM, go to the search bar, and type PHP.
  3. In the Software section in the left-hand menu, click on the MultiPHP INI Editor.
  4. PHP settings are changed on a per-version basis, so you first need to choose from the drop-down list the appropriate version.

    If you are unsure what version is currently active for a domain, this can be checked through WHM (see the Versions section below).

  5. The most commonly changed settings can be found in Basic Mode. These can be changed under the Setting column by clicking the button to enable/disable or filling in the field with the appropriate value. When done, click the Apply button at the bottom of the screen.
    • Typically, most servers and website applications should not need a memory_limit higher than 384 MB or a max_execution_time greater than 30 seconds. If a script requires so many resources, it typically indicates an issue with the application that should be addressed instead.
    • While it may be tempting to set parameters like memory_limit and max_execution_time to very high values, this can have adverse effects such as causing the server to run out of memory or lock up. This is especially the case on smaller servers with limited resources. Increasing the value will not speed up your site.
  6. If the parameter you want to change is not listed in Basic Mode, click on Editor Mode and select the PHP version there to get the full list of options, such as error_reporting. When done, click the Save button on the right of the screen.
  7. Below is a basic explanation of the settings in the basic editor.
    Basic Editor Settings
    Allow_url_fopen We recommend leaving this off for security reasons unless your PHP applications need it enabled.
    Display_errors Leave this off unless you are using it to debug your PHP applications currently. Once finished, this should be disabled.
    File_uploads This can be on and is needed to be able to upload media to your websites via their dashboards.
    Max_execution_time This is default set to 30 seconds and really shouldn't be updated. This is how long PHP processes can continue to run on the server. Setting this very high allows PHP processes to run for days, causing the server to run out of memory or Apache to lock up.
    Max_input_time This sets the maximum time in seconds a script is allowed to parse input data, like POST, GET and file uploads. This is how long a process can run like a Media upload. If something takes longer than 60 seconds, it should be uploaded via FTP instead.
    Max_input_vars The default is set to 1000, and it should not be increased as a higher limit may allow DDoS attacks to be more effective and possibly crash the server.
    Memory_limit This is the server's amount of RAM to allow a PHP process to run. Most WordPress websites do not need more than 128M of memory to run, and it should not be set to higher than 384M unless necessary. For example, if the server has 2GB of RAM, setting the memory limit to 512M could allow the server to run out of memory with only 4 PHP processes. If your PHP application requires 512M or more (like Magento), we suggest having at least 4G of RAM.
    Post_max_size This is the maximum size of uploads via PHP, like uploading files to the media library or the entirety of a newly created blog post. The default setting is 8M. Most website content should not be this large, as smaller images and media make a faster website. However, this can be adjusted if something is larger than 8M. We advise that you lower this once the large upload is completed.
    Session.gc_maxlifetime This setting is how long the server will store PHP sessions. This setting should not be adjusted unless you are a server administrator and need to adjust the setting.
    Session.save_path This is where PHP sessions (from above) are stored. Do not adjust this unless you are a server administrator and need it adjusted.
    Upload_max_filesize This goes with post_max_size directly. This is the maximum size of uploads via PHP, like uploading files to the media library or individual pictures in blog posts. The default setting is 2M. Most website content should not be this large, as smaller images and media make a faster website. However, this can be adjusted if something is larger than 2M. We advise that you lower this once the large upload is completed.
    Zlib.output_compression This setting allows PHP coding to be compressed before leaving the server. This is a setting that is default set to off. However, it should be enabled so that PHP website content can be compressed.

    Switching PHP Version

    1. Log into WHM (Web Host Manager).

      If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.

    2. In the search field, search for PHP. You should see the Software section in the left-hand column, then click on the MultiPHP Manager option.
    3. In the Set PHP Version per Domain tab, you'll see the account username, account owner, current PHP version, and whether PHP-FPM is on or off for each domain on the server.
    4. The PHP version for each domain is a drop-down list. As shown in the screenshot below, you can click on this to choose which PHP version is active from the current ones.
    5. The change will take effect immediately. We recommend taking a note of the old PHP version, so if the new version causes problems with the site, you can set the domain back to using the old version again, in the same way.

      Note: that changing the PHP version may result in other PHP parameters changing, as these are set on a per-version basis. See the Configuration section above for information on updating these parameters.

    6. If the version of PHP you need to use is not listed, don't hesitate to get in touch with support for help adding new ones to the server. Versions available are from 5.4 up.

    Installing new PHP versions via
    Easy Apache 4

    1. Log into WHM (Web Host Manager).

      If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.

    2. In the search field, search for Easy. In the left-hand column, you should see the Software section. Click on EasyApache 4 option.
    3. Select the Customize button inside the Currently installed Packages box.
    4. Choose the PHP Versions from the menu on the left.
    5. Pick the PHP version you would like to install (or uninstall). 

      Important:  When updating the PHP version, you will be prompted to install the extensions. We highly recommend doing this during the installation of a new PHP version to ensure the proper MySQL extension is installed. 
      To check the PHP extensions, kindly go to ( WHM >> Home >> Software >> EasyApache 4 >> PHP Extensions) From the search box field, type in MySQL.

    6. Select the button PHP x.x and Extensions.
    7. Select Review on the left-hand menu.
    8. Once loaded, review the installation and select Provision from the bottom. There will be a message that states that the provision is complete.


    Was this resource helpful?

    Did this resolve your issue?


    Please add any other comments or suggestions about this content:





    Recommended Help Content

    This article will explain how to use Easy Apache to recompile Apache. This is useful if you want to change the version of PHP or change other PHP and Apache settings.
    Knowledgebase Article 129,053 views tags: apache build compile dedi dedicated easy modules version vps

    How to change your PHP version in your hosting account
    Knowledgebase Article 889,235 views tags: config php selection version

    This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files.
    Knowledgebase Article 391,861 views tags: htaccess php

    Related Help Content

    Many popular website platforms use PHP for rendering their content. It’s common for these sites to have automatic update tools to ensure that they work with the latest version of PHP, however sometimes a theme or plugin for these services may prevent them from updating or may not work with a newer
    Knowledgebase Article 144,493 views tags: deprecation discontinue end php upgrade

    How to setup name servers for multiple cPanel accounts.
    Knowledgebase Article 269,015 views tags: accounts custom dedicated multi multiple nameservers server servers

    How do I change my contract length?
    Knowledgebase Article 304,446 views tags: change contract hosting length package payment

    How to edit PHP Configuration --- VPS or Dedicated
    Knowledgebase Article 175,929 views tags: dedicated php root vps whm

    If you need to transfer or restore a cPanel account for your VPS or Dedicated server, there is a tool within the WHM panel to perform these tasks. This article is about transferring or restoring from another server or restoring after a re-image.
    Knowledgebase Article 78,886 views tags: backup cpanel dedicated hosting restore server transfer vps

    VPS and Dedicated customers with servers running the CentOS 6 operating system will not be able to upgrade cPanel past version 86. The cPanel team will still support CentOS 6 with cPanel 86 until March 31st, 2021.
    Knowledgebase Article 97,637 views tags: centos cpanel dedicated hosting private server upgrade virtual vps

    In the newer versions of PHP, they have included a new directive to control and handle remote includes. We disable this option, by default, which may affect some of your PHP scripts.
    Knowledgebase Article 174,189 views tags: include php remote url

    Hard refresh after changing the .htaccess
    Knowledgebase Article 230,484 views tags: apache

This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here