Installing php7.4 causing a series of problems

My Ubuntu18.04 server was running well with multiple websites running under php7.2. Recently I was trying to upgrade my sites to php7.4 but haven’t been successful yet. I have lots of questions during the process.
Basically I was following this guide:
The commands I executed are:

apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt install libapache2-mod-php
apt install php7.4 php7.4-common php7.4-opcache php7.4-cli php7.4-gd php7.4-curl php7.4-mysql

I also did the same for php7.3.
All my websites are running under fcgi mode and I am not intended to use fpm, for now.

My first question is about the apache module. I noticed that after executing commands above, there are two new modules in webmin->servers->Apache Webserver->Global Configuration->Configure Apache Modules, they are php7.3 and php7.4. What do these modules do? It seems to me they are irrelevant if I run my site with fcgi, am I right? But they do have an impact on my site’s behavior - after I enable all of them or anyone of them other than php7.2 and restart apache server, my websites will start to download index.php file instead of executing it, can someone explain it to me or point me to some guide? And, if I disable them all, the apache server won’t start and give an error message saying
“Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code. See “systemctl status apache2.service” and “journalctl -xe” for details. failed!”

My second question is regarding the error log. While making sure only php7.2 module enabled( I am trying to install php7.4 I don’t understand why I have to enable 7.2 module but as I mentioned above if I don’t the server either won’t start or won’t execute PHP file ), I go to Virtualmin->Server Configuration->PHP Versions and change the version to 7.4.3, now when I open my Joomla websites, there will only be a blank screen with only one word on it: “Error”. Now according to my past experience, this usually means something wrong with connection with the mysql server. I check the mysql server it is running and all of my other websites running under 7.2 are good. So I go to “Logs and Reports->Apache Error Log” trying to find out what is wrong, but there is nothing there; meanwhile, I create a simple PHP file and put some error codes and phpinfo() in it, then try to open it with my browser. The error gets recorded in the “Apache Error Log” page and phpinfo shows php7.4.3. So, why the Joomla error was not recorded in the error log? Is there anything in the PHP script preventing that?

That’s a lot of questions, I never studied how to manage linux server and I don’t have time to. There are so much to learn and my strategy of learning is only learn what I have to. I hope someone can point me to the right direction or at least let me know what I have to learn to solve this. Thanks in advance.

P.S. I remember I encountered this problem before and I solved it with editting httpd.conf and some loadmodule script. Of course I was just blindly following some article I searched on Google. I am not suer if it is going to work this time, so before I tap into that water, I’d like to find out why simple installing PHP didn’t work and the .conf file has to be edited.

imo stick with 7.2 if you are running 18.04. it will be updated from ubuntu for as long as 18.04 is updated. HOwever 20.04 is out and it has php 7.4 natively. I would highly suggest you moving to 20.04 if you want to have php 7.4(virt support needs to be there first). Otherwise you are going outside of what virt does…and that gets interesting very quickly.

I don’t think the problem has to do with php7.4. I encountered similar problems when I tried to upgrade from 5.6 to 7.0, 7.0 to 7.2, and also in the current machine I installed 7.3 and it has the same behavior.

Installing mod-php breaks things. Don’t do it.

Edit: To be clear…you do not need or want mod-php. It adds handler rules that break all of the Virtualmin PHP related configuration.


when you say mod-php are you referring to libapache2-mod-php?

Yes. It installs a configuration file that applies a PHP handler to all domains, breaking all domains.

1 Like

I followed the same guide and it broke all sorts of things, in the end I ran the with --uninstall then ran it again to install Virtualmin. This sorted out most problems.

Please don’t follow that guide! It gives bad advice (mod_php is always bad advice).

But, you don’t need to reinstall Virtualmin. Just get rid of the mod_php package and the config files it creates, and run a Configuration check so Virtualmin can find the changes.

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