VPS & Dedicated Hosting: Change Your PHP Version and Configuration - EasyApache 4 | Bluehost Support
  1. bluehost knowledge base

VPS & Dedicated Hosting: Change Your PHP Version and Configuration - EasyApache 4

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.
    WHM Search field
  3. In the Software section in the left-hand menu, click on the MultiPHP INI Editor.
    WHM 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.
    WHM PHP Settings

    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.
      WHM MultiPHP Editor Basic Mode
  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
    WHM MultiPHP Editor Editor Mode
  7. Below is a basic explanation of the settings in the basic editor.
    Basic Editor Settings
    Allow_url_fopenWe recommend leaving this off for security reasons unless your PHP applications need it enabled.
    Display_errorsLeave this off unless you are using it to debug your PHP applications currently. Once finished, this should be disabled.
    File_uploadsThis can be on and is needed to be able to upload media to your websites via their dashboards.
    Max_execution_timeThis 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_timeThis 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_varsThe 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_limitThis 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_sizeThis 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_maxlifetimeThis 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_pathThis is where PHP sessions (from above) are stored. Do not adjust this unless you are a server administrator and need it adjusted.
    Upload_max_filesizeThis 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_compressionThis 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.
      WHM MultiPHP Manager
    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. 
      php-version-dropdown
    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.
      WHM EastApache4
    3. Select the Customize button inside the Currently installed Packages box.
      customize-currently-installed-packages
    4. Choose the PHP Versions from the menu on the left.
      php-versions
    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.

      php-mysql-extensions
    6. Select the button PHP x.x and Extensions.
      php-and-extentions
    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.

     

    For further assistance, you may contact our Chat Support or Phone Support via 888-401-4678. You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.