Trouble getting PHP to run with Apache

SYSTEM INFORMATION
OS type and version REQUIRED
Virtualmin version REQUIRED
Usermin version 1.860
WEbmin version 2.010

When I run the checking configuraton I get an error

  1. No PHP execution modes are available
  2. Apache mod_fcgid is missing or not enabled
  3. mod_SSL is missing or not enabled

So when I go to the global config tab of Apache 2.4.41 PHP 7.4.3

  1. even when I check to enable PHP or CGI mod–they are not enabled
  2. if I check to enable mod_fcgid–Apache will not start
  3. If I check to enable mod_ssl–Apache will not start

I do not know what to do, please help

I typed it in but it did not appear

OS–Ubuntu Linux 20.04.5
Virtualmin ver: 7.3 pro
Usermin 1.860
Webmin 2.010

1 Like

We need to see a bit more information, I think.

But, this sounds bad:

This sounds like you installed mod_php. You should never do that. It is usually in the php or phpVERSION-php package. Installing that is always a mistake.

Mod_php is not active. Also this site did work until around 3 months ago. It stopped working after a virtualmin update. Never worked afterwards. Hoped future update would fix it. Since this is a test server i sort of forgotten about it but i now need the server as i transition to Jomla 4.0

Do i need to reinstallApache or the entire server. Obviously easy is better.

It doesn’t matter if it is active.

If you installed mod_php, you broke PHP execution using any other execution mode. The mod_php package provided by distros breaks mod_fcgid and PHP-FPM execution, unless you explicitly configure it to not do so.

So…again: It sounds like you installed mod_php (we do not install mod_php under any circumstance), and before anything else, you should uninstall mod_php.

That doesn’t really help troubleshoot it. Upgrading Virtualmin does not alter the PHP or Apache configuration. Something would have had to have changed in addition to that (maybe an upgrade of Apache or one or more of your PHP packages…or installation of mod_php).

Holy hell, no!

Don’t mess with Apache. It’s not to blame, and if you uninstall it, you’ll do a lot of additional damage.

Thanks. I don’t remember installing this. How do I uninstall mod_php.

Also the module is called php not mod_php if that makes a difference

As I said above, “It is usually in the php or phpVERSION-php package.”

If you followed any docs you found on the web, other than ours, for installing newer PHP versions or setting up PHP or whatever, they probably recommended you install that package, which is always a mistake (not just for Virtualmin, mod_php is never recommended by anyone who knows…including the PHP developers).

You can list installed php packages with dpkg -l |grep php

You’re looking for a package named simple php or a package named phpSOMEVERSION-php.

The module called php is mod_php.

I tried as best as I could to uninstall mod_php but was unable to succeed. I believe it was the Ubuntu updates that added this. In desperation, I upgraded Ubuntu to version 22.04 which added PHP 8.0 which I will need to upgrade Joomla. I noticed that Ubuntu also added mod_php which I was unable to remove. Since Ubuntu is doing this, I cannot believe I am the only person with this problem. This might be due to the way I initially installed this machine first using LAMP to install Apache, MySQL and PHP before adding Virtualmin but there probably will be others who will do the same thing. Also, for years Virtualmin did run, and it was probably a recent update to Ubuntu that broke Apache. However, I believe the Virtualmin developers need to find a way to uninstall mod_php and put it in their product since this is an issue.

On another note, as I mentioned in my reply to another user, when I updated Ubuntu to version 22.04, it broke ProFTPD. My question, is Virtualmin compatible with Ubuntu 22.04?

I have given up on this computer and will be installing Ubuntu and Virtualmin on a new computer, not using LAMP which will hopefully fix my problems. The computer I was using was very old and slow anyway. My question about Ubuntu version 22.04 is relevant since I would like to start out with the most recent version of the OS.

Joe, thanks for your prompt answers to my questions. I was good that you steered me in the right direction.

It was not. You’ve explicitly installed mod_php, or you installed some package that depends on it (any web app packaged by the Ubuntu folks might do this).

Ubuntu did not add it. You did, and all you have to do is uninstall it using the package manager.

So, what error do you get when you try to uninstall the libapache2-mod-php package?

dpkg -r libapache2-mod-php

Edit: Actually, I just remembered that on Ubuntu the php package is just a metapackage that depends on libapache2-mod-php. You need to uninstall that package. The way it usually gets installed is people install php thinking they need it to run PHP apps. Or, it may be libapache2-mod-php7.2 or whatever version you have installed. You really need to follow my suggestion about.

I tried running that command it did not work.

I asked the following:

If you won’t even try to provide the information I ask for, I can’t, and won’t, try to help you.

I’m sorry if I upset you. I will answer your questions.

Executing the command you requested.

dpkg -r libapache2-mod-php
dpkg: warning: ignoring request to remove libapache2-mod-php which isn’t installed

I decided to look at the loaded packages next:

Then I decided to try libapache2-mod-php7.4 and lipapache2-mod-php8.1

then just to check–I only listed the relevant snippet.

To summarize, it looks like fixing this is not easy. The machine that I am running this server on is very old and slow. I decided that it is easier to start from scratch with a newer faster computer that I was not using for anything else. Since this is not my production server but only a test server–I really did not have much setup.

Your input was very valuable to me. I learned what not to do when setting up this server. I believe my mistake was loading LAMP by myself before installing Virtualmin. But I was just experimenting at the time. You taught me about PMP and Apache.

I will run additional commands if you believe it will give any useful information. If not, I am going to decomission this server. I did not mean to upset you, but since I was using my cell phone to run these commands, copying the output was not easy. Once again, I appreciate your quick response to my query and I found them very useful.

Regards,
Michael

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).

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.