Bluehost 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.
- Log into your WHM.
If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.
- Once in the WHM, go to the search bar, and type PHP.
- In the Software section in the left-hand menu, click on the MultiPHP INI Editor.
- 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).
- 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.
- 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.
- 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
- Log into WHM (Web Host Manager).
If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.
- 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.
- 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.
- 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.
- 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.
- 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- Log into WHM (Web Host Manager).
If you see the Feature Showcase, scroll to the bottom and click the Exit to WHM button.
- In the search field, search for Easy. In the left-hand column, you should see the Software section. Click on EasyApache 4 option.
- Select the Customize button inside the Currently installed Packages box.
- Choose the PHP Versions from the menu on the left.
- 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. - Select the button PHP x.x and Extensions.
- Select Review on the left-hand menu.
- Once loaded, review the installation and select Provision from the bottom. There will be a message that states that the provision is complete.
Knowledgebase Article 153,145 views bookmarksharetags: easyapache php vps whmShare or save this via:
Recommended Help Content
Easy Apache
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.
How To Change Your PHP Version - PHP Config Guide
How to change your PHP version in your hosting account
How To Add Handlers To Change PHP Version - PHP Version Setup
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.
Related Help Content
What to do if your Site Does Not Work with Newer Versions of PHP
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
VPS or Dedicated Hosting - Using Multiple cPanel Accounts To Set Custom Nameservers
How to setup name servers for multiple cPanel accounts.
Change Length of Hosting Plan
How do I change my contract length?
How to edit PHP Configuration
How to edit PHP Configuration --- VPS or Dedicated
VPS and Dedicated Hosting: Restore or Transfer cPanel
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.
CentOS 7 and cPanel Upgrades
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.
Allow_url_include
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.
Must I restart Apache after changing a htaccess file?
Hard refresh after changing the .htaccess
- Log into WHM (Web Host Manager).