Blog · 17/02/2021

Webmin will not let you change the PHP mode or version

Webmin will not let you change the PHP mode or version

Webmin is a control panel that allows us to manage any Linux server through a friendly browser-based interface.

This control panel allows you to configure the execution modes in which you can run PHP as well as the versions you want to run for each domain.

Screenshots to configure the execution modes of PHP scripts

The available methods of execution can be:

  • CGI: Enables you to run the PHP script as a virtual server owner
  • FCGId: Enables you to run the PHP script as a virtual server owner
  • FPM: Enables you to run the PHP script as the virtual server owner

Webmin also allows you to change the version of PHP that you want to use for each of the domains.

Screenshots to set up PHP versions

In some cases, it may occur that, for example, after an Apache update or the different versions of PHP, a incompatibility is produced with Webmin’s own way of working.

This may result that Webmin is unable to set the selected PHP execution mode or the version of the PHP that you want to use in the domain.

Check the listening port in Apache and PHP

To try to know where the error may be, the main thing is to make sure the connection port to run the PHP is correct both in the Apache settings and in the PHP settings of the domain.

To do so in Virtualmin go to Services -> Configurate website, in case you have the SSL activated, you will also have to go to Configurate website for SSL.

And then we go in each of the options to Edit Guidelines to access the Apache Domain Configuration File.

Now we will have to look at the FilesMatch section to check to which port the SetHandler is directed, in this case it is at port 8026.

Then we proceed to check that in the PHP configuration it is also referred to the same port.

To do so, see Virtualmin, Services and click PHP-FPM Configuration to access the PHP file configuration of the domain.

Now you just need to click Edit Settings manually to see the configuration file:

And we make sure that the hearing port is the same as that is configured in Apache, in this case it is correct, it is again the port 8026.

If it wasn’t the same port it would simply put the same, according to your case the correct will be the Apache or the PHP configuration file.

Anyway, you can always try to change the PHP execution mode in Virtualmin, Server Settings and Website Options to check if the problem is solved.

Remove the symbolic PHP links from the global Apache configuration

In case this configuration is correct, you should check the global configuration of PHP in Apache.

To do this, you need to go to Webmin -> Server -> Apache Web Server -> Global Configuration -> Edit Configuration Files.

Here you should check the overall PHP files of each of the versions that are activated in the system.

Exam: /etc/apache2/conf-enabled/php X.X -fpm-conf

In each of the configuration files we delete the symbolic links that make reference to the PHP connection.

It’s just to re-start Apache and check that everything works again as it should.

sudo service apache2 restart

In this Hilo it is the error that is just described: https://sourceforge.net/p/webadmin/bugs/5453 /

If you know a better way to do it, don’t hesitate to comment on it!