VPS & Dedicated Hosting: Change Your PHP Version
Managing your website's performance and compatibility is of utmost importance, and you can ensure optimal functionality with the latest version of PHP. If you are a Bluehost VPS or Dedicated Hosting user, learning how to change your PHP version and configuration is not a big task for you. You can easily do this through Web Host Manager. This tutorial will guide you on how to change your PHP version using EasyApache 4.
EasyApache 4 only
The following steps apply to servers running EasyApache 4. However, in most cases, that should be true, older servers may still be running EasyApache 3. If you can't find the Software » EasyApache 4 section in WHM, then your server is running on EasyApache 3.
Configuration
Recommended values: While seemingly tempting to use parameters like memory_limit and max_execution_time, almost all of the time, one would be well advised to avoid using too high values lest horrible effects such as running out of memory or having the server totally lock up befall. Especially for small servers with little in the way of resources.
- Log into your WHM.
When you are on the screen with the Feature Showcase, scroll down and click on the Exit to WHM button.
- On the WHM, scroll down and search for "PHP".
- On the Software section of the left side menu, click on MultiPHP INI Editor.
- PHP configuration is done differently for every version. So, you have to pick the one that fits by using the dropdown box.
If you are not sure which version is active for a domain, you can find out 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 currently using it to debug your PHP applications. Once finished, this should be disabled. File_uploads This feature must be enabled to allow media uploads directly through your website dashboards. Max_execution_time This is set by default to 30 seconds and should not be changed. This is the length of time PHP processes are allowed to run on the server. If this is set very high, it will allow PHP processes to run for days until the server runs out of memory or Apache locks up. Max_input_time This will set the maximum number of seconds a script should take to parse input data, such as POST and GET and file uploads. Something like a media upload might take this long. If the process takes more than 60 seconds, it ought to be uploaded through FTP. Max_input_vars It is set to 1000 by default, and this should not be done so as this may raise the DDoS effectiveness and may crash the server. Memory_limit This is the server's amount of RAM that allows a PHP process to run. Most WordPress sites don't need more than 128M of memory to run. It should not be set higher than 384M unless it is necessary. For instance, if your server has 2GB of RAM, you would set the memory limit to 512M, and that might leave your server out of memory when running just 4 PHP processes. If your PHP application uses more than 512M, such as Magento, we recommend a minimum of 4G of RAM. Post_max_size This is the maximum size of uploads via PHP, such as uploading files to the media library or the whole of a newly created blog post. It is, by default, 8M. Most of your website's content shouldn't be as big as small images, and media should make for a faster site. However, it can be adjusted if something is over 8M. We recommend that you reduce it after you upload the big file. Session.gc_maxlifetime This is the number of seconds the server will remember PHP sessions. This configuration should not be changed unless you are the administrator on the server and plan to change it. Session.save_path This is where all the PHP sessions above get stored. Do not edit this unless you must become a server administrator, and it needs to be edited for you. Upload_max_filesize This is all in tandem with post_max_size. This is the maximum size that files may be uploaded through PHP, such as uploading images to your media library or single images within a blog post. It defaults to 2M. Most everything you'll upload to this site won't be remotely this big, as smaller images and media help make your site speedier. Still, it's something that, if it is greater than 2M, you can turn it up if you have a large image or movie. We'd suggest dialing it back down when that's all done. Zlib.output_compression This compression compresses your PHP coding before it sends it out from the server. This is a turned-off default setting that has to be enabled so as to compress the content meant for the PHP website in question. Switching PHP Version
- Log into your WHM.
If the Feature Showcase window appears, scroll down and hit Exit to WHM.
- Search for PHP in the search box. The Software section will appear in the left-hand column. Click MultiPHP Manager.
- You will see the details for each domain on the server in the Set PHP Version per Domain tab, such as the account username, account owner, current PHP version, and the status of PHP-FPM.
- Each domain's PHP version is a dropdown menu. Below, you see the screen you click on to choose which version of PHP is active versus those currently selected.
- The change will be instant. You can note the current version of PHP, and if you encounter any problems with the site after the update, you can revert back to the old version of PHP by using the same method above.
Note: Switching between PHP versions can cause other PHP settings to change, as they can be version-based. If you need to change anything, see the Configuration section above.
- If you need to use a version of PHP that is not listed here, please don't hesitate to contact our support department to assist you in getting the new ones added to the server. Available versions are 5.4 up.
Install new PHP versions via
Easy Apache 4- Log into WHM (Web Host Manager).
If the site displays the Feature Showcase on the page, hit the Exit to WHM button at the bottom of the page.
- In the search field, enter Easy. On the left side, you will see the Software section. Click on the EasyApache 4 option.
- Click the Customize button inside the Currently installed Packages box.
- From the menu on the left, select PHP Versions.
- Choose the PHP version you need to install (or uninstall).
Important: If you are upgrading your version of PHP, you will be asked to install extensions. We recommend that you upgrade those at the same time as you upgrade to a new version of PHP so the MySQL extension will be correct.
Access (WHM >> Home >> Software >> EasyApache 4 >> PHP Extensions) by entering the field in the search box and typing in MySQL to access the PHP extensions. - Select the button PHP x.x and Extensions.
- Select Review on the left-hand menu.
- Once loaded, follow the installation and select Provision from the bottom. A message should appear indicating that the provision is complete.
- Log into your WHM.
Summary
Keeping your version of PHP updated in both Bluehost's VPS and Dedicated Hosting platforms gives you peace of mind, knowing that you are running your website with the utmost performance and maximum security. The steps provided above using EasyApache 4 make updating your PHP configurations easy. If any problems arise or if you need someone to help walk you through the process, Bluehost's support is here to ensure you find a solution for your specific needs.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.