How to change "default" setting of php from php7.4 to 8.2?

I just upgraded from Ubuntu 20.04 to 22.04. The upgrade went very well. I just selected to keep the local config files for all prompts and websites and HestiaCP appears to be intact.

As I was doing this, I realized php7.4 was still active on all my websites and I had php8.2 available to enable. I enabled this and set it as the default for the system. However, all websites were broken with internal server error (error 500).

I had to change setting on each domain one by one by “default” dropdown option to the “php8.4” option. My question is why, since Php8.2 was set as the default system setting for PHP in the main server configuration page.

I see that it’s using the backend_template variable which appears to be using the php7.4 value. So that’s why php-fpm was broken and unable to serve the page. Once I changed setting on each domain to php8.4, the internal server error was resolved.

My question is, why does the default option for each domain uses 7.4 and not 8.4. Where is this default setting set that uses php7.4?

Hello @user7632726,

As far as I know, changing System PHP Version in Settings -> Configure -> Web Server should be enough (or using command v-change-sys-php 8.2).
That should change default php version and should rebuild all the web domains so web domains would use the new default php version.

Could you please show the output of these commands?

ls -l /etc/alternatives/php
php -r "echo substr(phpversion(),0,3);"


1 Like

Sorry for the very late reply.

Yes, this is what I thought as well. I did set all domains to PHP 8.2 in Settings → Configure → Web Server as the default. However, when going into each Web Domain individually, under the “Backend Template” field, the dropdown was selected to “default”, but it still used php7.4.

I had to change each of the domains on the Web Domain edit page under Backend Template to use PHP-8_2. That was the only way I got them all to use php8.2.

the v-change-sys-php 8.2 command, when run in the terminal window produces the following response: v-change-sys-php: command not found

Am I supposed to run it with some specific command before the text: “v-change-sys-php”?

This command “ls -l /etc/alternatives/php”, yields this result: lrwxrwxrwx 1 root root 15 Sep 30 11:23 /etc/alternatives/php → /usr/bin/php8.2

This command “php -r “echo substr(phpversion(),0,3);””, yields this result: 8.2

This command “v-list-sys-php”, yields: v-list-sys-php: command not found

I wonder if default.tpl is updated …

It doesn’t look like it

It is probally just beter to select php version instead of default.tpl …