Trouble getting PHP to run with Apache

Sorry I got grouchy with you, we just have mod_php problems every single day, no matter how often I tell people to stop installing the damned thing.

Yeah, that’s asking for trouble, especially if you were following a guide that told you to install mod_php (but, also in general, Virtualmin wants to install on a freshly installed supported OS, anything else will make a mess).

There’s nothing wrong with setting up your own development server for learning. In fact, I think that’s a great idea. But, do it on a VM and don’t use it in production. And, don’t ask Virtualmin to figure out all the things you’ve done that are different from current best practices (mod_php has been discouraged by the PHP devs for well over a decade…even longer, really…nobody should have been using mod_php in all that time, and yet here we are still cleaning up messes created by mod_php).

The config files that are left laying around are the cause of your problem, by the way. A purge probably would clean them up. /etc/apache2/mods-enabled/php* is probably still present and still breaking things. Everything in etc is considered a config file by dpkg, so when you remove a package it tries to protect those files…but, the config files bundled with the mod_php packages are harmful, and leaving them continues to cause trouble (they configure Apache to handle PHP files in a way that prevents any other execution mode from working). But, you obviously did have mod_php installed (rc indicates they were removed, but config files remain).

I continue to beg people to stop installing mod_php, to no avail.

I’ll also note that the php package (and phpVERSION-php) is also a problem and should not be installed, as it Recommends libapache2-mod-php (I think, or something…it pulls in mod_php, somehow). So never install it either. Following LAMP and PHP guides on the internet often suggest installing mod_php or php, so be careful whose advice you listen to.

And, as always the Virtualmin install script should be run on a freshly installed OS (as covered on our download page).