Failed to save PHP options : Apache virtual host was not found

SYSTEM INFORMATION
OS type and version: Ubuntu 20.04
Webmin version: 1.973
Virtualmin version: 6.15

New Ubuntu server, moving web sites from an older Virtualmin server via Virtualmin backup and restore. This server is an archive of old “annual” sites, so there are a lot of similar ones. The new server uses FPM, the old one used FCGId. I had a certain set of sites migrated successfully, everything on those WAS working. All sites were using wildcarded IP addresses (*), and on restore I selected the option to use the old IP address, then changed the php mode to FPM. All was good on the first set.

The second set caused trouble though. On restore, Virtualmin complained about FPM being unable to restart. Using systemctl status I found that a group was specified that didn’t exist (nor did it exist on the old server, but that wasn’t using FPM). I changed the group in the pool file, but then on updating the mode page, I get:

Failed to save PHP options : Apache virtual host was not found

Figuring that something was screwed up with the sites because of the FPM failure, I deleted the 2nd set of sites. I then went to one of the other sites in the first set to try updating FPM and it ALSO gives that error.

Googling, I see that “wrong” ports (and IP addresses?) can prevent a site from being found (they definitely exist!) so I ran Re-Check Config, still got the error, then tried specifying the current IP address for the site. Still get the same error. More googling, and I see a recommendation to disable and then re-enable the site. Still get the same error.

How can I fix this?

Also,I tried virtualmin validate-domains --all-domains --feature web and it reports All features OK for every site.

I have found that changing the php option to FCGId, saving, then changing it back to FPM allows the virtual host to be “found” again.

Hmmm, changing the php execution mode does indeed seem to work.

But if I got back to that page and simply select Save (without changing anything) I still get the

Failed to save PHP options : Apache virtual host was not found

So maybe this error message is an error itself? “failed to save” is because there’s nothing changed to save, and “Apache virtual host was not found” is the wrong reason there was no save?

The status of your system is being checked to ensure that all enabled features are available, that the mail server is properly configured, and that quotas are active …

Your system has 11.73 GB of memory, which is at or above the Virtualmin recommended minimum of 256 MB. ![blank|23x20](upload://bqpGriz8ggELxxrO26M56Lh6N3D.png)


Apache is installed.

The following PHP versions are available : 7.0.8 (/usr/bin/php5-cgi), 7.0.8 (/usr/bin/php-cgi7.0)

PHP versions have changed to 5, 7.0 since last check. Regenerating any missing php.ini files.

Apache virtual host was not found

Running virtualmin check-confg as root/sudo may fix the Failed to save PHP options : Apache virtual host was not found problem. Did it for me.

I am running CentOS 8

[ns2@ns2 ~]$ sudo virtualmin check-config Your system has * GiB of memory, which is at or above the Virtualmin recommended minimum of 256 MiB. BIND DNS server is installed, and the system is configured to use it. Mail server Postfix is installed and configured. Postfix is configured to support per-domain outgoing IP addresses. Apache is installed. The following PHP versions are available : 7.2.24 (/bin/php-cgi), 7.3.33 (/bin/php73-cgi), 7.4.27 (/bin/php74-cgi) The following PHP-FPM versions are available on this system : 7.2.24 (php-fpm) 7.3.33 (php73-php-fpm) 7.4.27 (php74-php-fpm) The following PHP execution modes are available : none fpm Webalizer is installed. Apache is configured to host SSL websites. MariaDB 10.3.28 is installed and running. ProFTPD is installed. Logrotate is installed. SpamAssassin and Procmail are installed and configured for use. ClamAV is installed and assumed to be running. Plugin New Mailbox Signup is installed OK. Plugin AWstats reporting is installed OK. Plugin Administrator’s Notes is installed OK. Plugin Analytics Tracking is installed OK. Plugin DAV Login is installed OK. Plugin Protected web directories is installed OK. Plugin Virtualmin Support Links is installed OK. Plugin Additional content styles is installed OK. Plugin Additional content styles from OpenWebDesign.org is installed OK. Using network interface eth0 for virtual IPs. IPv6 addresses are available, using interface eth0. Default IPv4 address for virtual servers is 1.5.1.2. Default IPv6 address for virtual servers is 2:3::f:9:f:2. Both user and group quotas are enabled for home and email directories. All commands needed to create and restore backups are installed. Resource limits are supported and configured correctly. The selected package management and update systems are installed OK. Chroot jails are available on this system The Virtualmin YUM repository is configured correctly OK
[ns2@ns2 ~]$