Error 500 after migration solved only by manual version/mode toggle

SYSTEM INFORMATION
OS type and version Debian 13
Webmin version 2.630
Virtualmin version 8.1.0 GPL
Webserver version Apache/2.4.66
Related packages PHP 5.6, 7.0, 7.4, and 8.4

Hello,

I have encountered an issue that occurs after migrating web project contents or performing a major OS upgrade (e.g. Debian 9->12). Some websites start returning “500 Internal Server Error”.

The current workaround is to manually go to Server Configuration → PHP Versions and toggle between different PHP versions or execution modes (e.g., switching from FPM to FCGI and then back to FPM). This resolves the issue most of the time.

I would appreciate any insights on how to ensure the configuration is correctly applied during migrations/upgrades.

Did you preinstall the needed packages for the PHP versions in question and did you check the logfile in question?

PHP packages were installed manually on a clean machine. There are no errors in logs corresponding to PHP/Apache

Yes, this is the best solution for now after a major distro upgrade. The issue happens because default PHP versions change between major releases, so we can’t easily automate it.

More details and further discussion are available here.