Learning how to change a PHP version in cPanel is a game-changer for enhancing your website’s performance and compatibility.
PHP, or Hypertext Preprocessor, is the powerhouse scripting language behind many websites.
Each version of PHP comes with unique features, performance upgrades, and security enhancements.
By updating the PHP version through cPanel, you can ensure your site runs smoothly and efficiently, taking full advantage of the latest improvements.
In this article, we’ll guide you step-by-step on how to change your PHP version in cPanel, so your website stays in top shape.
Understanding PHP Versions
Let’s explore PHP and see why staying updated with its versions matters so much.
What is PHP and Why Does the Version Matter?
PHP, short for Hypertext Preprocessor, is a super popular open-source scripting language used for web development.
It helps developers make dynamic and interactive web pages by embedding code right into HTML.
In other words, PHP is the backend programming while HTML is the front end programming of a webpage.
Now, why should you care about which version of PHP you’re using?
Well, each version brings along improvements, security fixes, and new features that can seriously boost your website’s performance and functionality.
Overview of Different PHP Versions
PHP has gone through a lot of changes over the years. Let’s look at the highlights of the most recent versions.
PHP 7.x: This version brought massive performance boosts and lower memory usage compared to older versions.
It also added features like scalar type declarations and return type declarations, which make the code more reliable and easier to maintain.
But heads up! Support for PHP 7 ended in November 2022, so it’s time to consider upgrading if you haven’t already.
PHP 8.x: This has the latest versions, including 8.0, 8.1, 8.2, and 8.3.
They have introduced game-changing features like Just-In-Time (JIT) compilation, union types, and named arguments.
PHP 8.1 added even more cool stuff like enumerations and fibers.
PHP 8.2 is the latest PHP version which brings readonly classes, DNF types, null , false , and true types. It also includes sensitive parameter redaction support, a new random extension, and several new features along with a few deprecations.
PHP 8.3 is on the way with more advanced features.
Common Reasons for Updating PHP
Updating PHP isn’t just about getting the latest features; it’s crucial for several reasons:
Security: Each new version patches up security holes found in previous versions.
Running an outdated version can leave your site vulnerable to attacks, so staying updated is a must for keeping your website safe.
Performance: Newer PHP versions are faster and more efficient, meaning your web pages load quicker and use fewer server resources.
This leads to a better experience for your visitors and can improve your site’s performance overall.
Features: With each update, you get access to new tools and coding practices that can make your life as a developer easier.
Plus, it ensures compatibility with the latest frameworks and libraries, so you can take advantage of the newest advancements in web tech.
So, always keep an eye on PHP updates to make sure your web projects run smoothly and securely!
How to Access Your cPanel Dashboard
Now, let’s jump into your cPanel dashboard and learn how to change PHP version from there.
Logging into cPanel
Open Your Browser: Fire up your favorite web browser.
Enter the cPanel URL: In the address bar, type your domain name followed by /cpanel.
For example, go to https://yourdomain.com/cpanel and hit Enter.
You can also use cpanel.yourdomain.com or yourdomain.com:2083 to get straight to the login page.
Enter Your Credentials: You’ll see a prompt asking for your cPanel username and password.
You usually get these details in the welcome email from your hosting provider.
Forgot your password? No worries, you can reset it through your hosting account management panel.
Access the Dashboard: After entering your credentials, click the “Login” button.
Boom! You’re now in the cPanel dashboard, ready to manage all aspects of your hosting account.
Locating the Relevant Section for PHP Management
Now that you’re logged in, let’s find the spot to manage your PHP versions:
Scroll to the Software Section: Look for the “Software” area in your cPanel dashboard.
This is where you’ll find tools related to programming languages and software configurations.
Select PHP Selector or MultiPHP Manager: Depending on your hosting provider, you might see options like “Select PHP Version,” “MultiPHP Manager,” or “PHP Config.” Click on the one that fits.
Navigating to PHP Selector or MultiPHP Manager
Time to handle your PHP version in cPanel.
Depending on your cPanel version, you’ll find either “Select PHP Version” or “MultiPHP Manager” in the “Software” section of your cPanel dashboard.
Using Select PHP Version
If you see the “Select PHP Version” option, click on it to open the PHP management interface.
This handy tool lets you switch between different PHP versions and enable or disable PHP extensions and modules based on what you need.
Using MultiPHP Manager
On the other hand, if you have the “MultiPHP Manager” option, go ahead and select it.
The MultiPHP Manager gives you a more comprehensive interface for managing PHP versions across multiple domains or subdomains on your cPanel account.
Inside the MultiPHP Manager, you’ll see a list of all your domains along with their current PHP versions.
You’ll also see different PHP versions available from the dropdown menu.
If you’re on a VPS or Dedicated Server, you might need to manually install newer PHP versions since they may not be available in the MultiPHP Manager by default.
No worries, though—once installed, you can manage them just like the others!
Changing PHP Version Using Select PHP Version
1. Log in to your cPanel account and navigate to the “Software” section.
2. Look for the “Select PHP Version” tool and click on it to open the PHP management interface.
3. On the “Select PHP Version” page, you’ll see a dropdown menu with a list of available PHP versions.
Choose the one you want for your website.
4. Scroll down to the “PHP Extensions” section. Here, you can enable or disable PHP extensions based on your needs.
Just make sure they’re compatible with the PHP version you picked.
5. Once you’re happy with your selections, scroll down to the bottom of the page and click on the “Change PHP Version” button to apply the changes.
6. You’ll see a confirmation message indicating that your PHP version has been updated successfully.
Don’t forget to save your settings before leaving the page.
Changing PHP Version Using MultiPHP Manager
Log in to your cPanel account: Start by entering your cPanel URL, username, and password to access the dashboard.
Locate the “MultiPHP Manager” tool: In the “Software” section of your cPanel dashboard, find and click on the “MultiPHP Manager” icon.
This will take you to the PHP version management interface.
Choose the domain(s): In the MultiPHP Manager interface, you will see a list of all your domains and subdomains.
Use the checkboxes to select the domain(s) for which you want to change the PHP version.
Select the desired PHP version: Once you have selected the domain(s), look for the dropdown menu labeled “PHP Version” at the top of the page.
Click on it to reveal the list of available PHP versions.
Apply changes: After selecting the desired PHP version, click the “Apply” button to save your changes.
A confirmation message will appear, indicating that the PHP version has been successfully updated for the selected domain(s).
Verify the changes: It’s a good practice to check your website after changing the PHP version to ensure that everything is functioning correctly.
And that’s it! You’ve successfully changed your PHP version using MultiPHP Manager. Great job!
Verifying the PHP Version Change
So, you’ve just changed your PHP version using either the “Select PHP Version” tool or the “MultiPHP Manager” in cPanel.
Awesome! But how do you make sure the update was a success?
Using a PHP Info File
First up, You could use the PHP info file method.
Here’s what you do:
Create a new PHP file in your website’s root directory (something like phpinfo.php).
Pop in the following code:
<?php
phpinfo();
?>
Save the file and then open your web browser. Type in http://yourdomain.com/phpinfo.php and hit enter.
Voila! You should see a page displaying all sorts of PHP configuration details, including the current version.
Check if it matches the one you picked in cPanel.
If it does, you’re golden!
Just remember to delete the phpinfo.php file afterward to keep things secure.
Using the cPanel Dashboard
Now, let’s check via the cPanel dashboard:
Log in to your cPanel account and head to the “Software” section.
If you used the “Select PHP Version” tool, you’ll see the current PHP version right on that page.
Make sure it’s the one you selected.
If you used the “MultiPHP Manager,” you’ll find a table listing the PHP version for each domain.
Double-check that the version is updated correctly for the domain(s) you tweaked.
And there you go! Verifying your PHP version change is as easy as that.
Conclusion
Wrapping it up, when you change the PHP version in cPanel it’s crucial for your website’s performance, security, and compatibility with new features.
Just log in to your cPanel account, navigate to the “Select PHP Version” or “MultiPHP Manager” in the “Software” section, choose the domain, select the desired PHP version, apply the changes, and verify the update.
Regularly updating your PHP version keeps your site running smoothly and securely.
For more details, refer to the PHP Official Documentation, cPanel Documentation, and WordPress PHP Compatibility resources.