CentOS 8, mod_php missing

Issues related to applications and software problems and general support
Post Reply
smpoole7
Posts: 85
Joined: 2009/01/16 17:08:46
Contact:

CentOS 8, mod_php missing

Post by smpoole7 » 2021/07/11 04:18:35

CentOS 8, installed a LAMP stack, everything (including virtual hosts) seem to be working. I installed the SSL Cert and got no errors. But PHP isn't working, and I don't see a "mod_php" in the modules directory.

To be clear, when I say it isn't working, a PHPInfo script just appears in the page source without alteration. I have phpMyAdmin installed in one of the virtual hosts (for setup, it'll be disabled when I throw the server live), but I get a screen filled with JSON stuff and gibberish. PHP obviously isn't translating the PHP instructions and crafting a readable Web page. IOW, simply put: there's no php module being loaded.

Output of httpd -M | grep -i php shows nothing:

Code: Select all

[root@localhost ~]# httpd -M | grep -i php
[root@localhost ~]#
For comparison, here's the output from our existing CentOS 7 Web server, also running a classic LAMP stack:

Code: Select all

[root@crawfordbroadcasting ~]# httpd -M | grep -i php
 php7_module (shared)
[root@crawfordbroadcasting ~]# 
Some Googlin' suggests that we're supposed to use php_fpm now; that mod_php has been deprecated. I'm not sure how to install/enable it. Googlin' says that its' a separate module that'll have to be enabled via systemctl. Any thoughts? Suggestions? Deeply appreciated.

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: CentOS 8, mod_php missing

Post by remirepo » 2021/07/11 04:58:33

Yes php-fpm is now used by default (instead of old deprecated mod_php, which doesn't support threaded MPM now used by apache)

Simply install it, it is designed to work out of the box (thanks to provided configuration)


Notice:

- php-fpm is a service which need to be started/enabled (despite it is started automatically when http start)

- some explanation why php-fpm is better and should be used, even on C7, read https://developers.redhat.com/blog/2017 ... tion-tips/


P.S. mod_php is still available for httpd in prefork, which is highly discouraged, and will be totally removed in C9
Remi's Repository - Forum - Blog

smpoole7
Posts: 85
Joined: 2009/01/16 17:08:46
Contact:

Re: CentOS 8, mod_php missing

Post by smpoole7 » 2021/07/11 15:16:41

OK, thanks. That's what I thought. To be fair and honest, I think that *I* bollixed something in the config when I copied from the older Cent7 config files on the existing server.

Code: Select all

httpd -M
... snip ...
 fcgid_module (shared) ----- is this it?
 http2_module (shared)
 proxy_http2_module (shared)
[root@localhost httpd]# grep -ilsR fpm *
modules/mod_proxy_fcgi.so
Oh, well. If it was easy, we wouldn't have our cushy, high-paying jobs ...

smpoole7
Posts: 85
Joined: 2009/01/16 17:08:46
Contact:

Re: CentOS 8, mod_php missing

Post by smpoole7 » 2021/07/12 02:57:04

Followup: I got it working. I had obviously hammered the config files somehow. I'm not sure what I did, but the default installation would probably have worked.

Anyway. I solved this by creating a temporary Web server in a VirtualBox, systemctl enable php-fpm, and everything else recommended at some good Websites that I found in a Google search. It worked, so I copied the config over to the server that was giving me problems. Presto. He workee.

I've even got the virtual servers working, and I've got the certificate installed and working.

Sometimes, the best answer is just to start over. Especially if you're me. Everyone else on the planet will have varying mileage.

Post Reply