SIGN IN / UP
    opened image

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

    You may need to change the PHP version on the server if your site is using an older 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.

    Login to HestiaCP control panel

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


    Domain selection

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


    PHP version setting

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


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


    After selecting the PHP version, save the template settings.


    Apache and PHP-FPM restart

    You usually don't need to do anything for the changes to take effect. But still, 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 for Changes

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

    Go to the desired directory, in my case:
     

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


    Instead of domain.com there should be your domain.

    Create info.php file

     

     

     

    vim info.php
    

     



    You can paste the following code in this file:

     

     

     

     

    <?php
    phpinfo();
    ?>
    

     



    Open this file in a browser and look for information about the version of PHP that is in use on your domain.

     

     

     

     

    domain.com/info.php
    

     



    If the PHP version has changed to the one you need, then the setup 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 in the field of web hosting can perform.

    However, before changing the PHP version, you need to make sure that your site will work correctly with the selected PHP version.