opened image

How to change the PHP version in the HestiaCP panel?

HestiaCP is a panel that provides the ability to easily manage web servers, and one of the features that HestiaCP offers users is the ability to change the PHP version for a domain.

Changing the PHP version on the server may be necessary if your site is using an old version of PHP that is no longer supported, or if you want to use a new version of PHP to improve site performance. In this article, we will look at how to change the PHP version for a domain in the HestiaCP panel.

Logging into the HestiaCP control panel

The first step is to log into the HestiaCP control panel. After logging in, and after navigating to the "Web" tab, you will see a list of available domains on your server.


Selecting a domain

Select the domain for which you want to change the PHP version. Click on the domain to open its settings.


Configuring the PHP version

Configuring the PHP version for the domain is done through the "Web" tab. In the "Web" tab, select the domain and click "Edit Web Domain" to find the "Advanced Options" section.


Click on the template to open its settings. In the template settings, find the "PHP" section and select the desired PHP version from the dropdown list.


After selecting the PHP version, save the template settings.


Restarting Apache and PHP-FPM

To apply the changes, usually no additional actions are required. However, if necessary, you can restart the Apache web server and PHP-FPM. To do this, click on the "Server" tab and select "Service" from the submenu.


On the "Service" page, find the "Restart" button next to the name of the Apache web server and PHP-FPM. Click the "Restart" button to restart the web server.


Checking the changes

After restarting Apache, check that the PHP version has changed for your domain. To do this, you can create a simple PHP file using any text editor and place it on your domain.

Navigate to the desired directory, in my case:
 

cd /home/admin/web/domain.com/public_html/


Instead of domain.com  your domain should be here.

Create the file info.php

 

 

 

vim info.php

 



In this file, you can insert the following code:

 

 

 

 

<?php
phpinfo();
?>

 



Open this file in your browser and look for information about the PHP version being used on your domain.

 

 

 

 

domain.com/info.php

 



If the PHP version has changed to the one you need, then the configuration was successful.


As we can see, changing the PHP version for a domain in the HestiaCP panel is a fairly simple procedure that even a beginner can perform.

However, before changing the PHP version, it is important to ensure that your site will work correctly with the selected PHP version.