How to Remove php-fpm for mod-php

apache-2.4php-fpm

We have a site that's performing very slowly. I have a suspicion that it's php-fpm configs, but rather than play with it if it's not the issue, I want to do performance tests first.

So I cloned one of our load balancer production VMs and want to remove php-fpm but not sure how.

CentOS 7.6, httpd 2.4.38, php7.2

Stopping the php-fpm obviously does nothing but break it. Moving the file /etc/httpd/conf.d/php-fpm.conf just stops all interpretation of PHP files, so how I do get it back to mod_php?

EDIT:
1) Installed mod_php72u.x86_64
2) Added a php.conf file in /etc/httpd/conf.d/ with the following contents:

#
# The following lines prevent .user.ini files from being viewed by Web clients.
#
<Files ".user.ini">
    Require all denied
</Files>

#
# Allow php to handle Multiviews
#
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

# mod_php options
#
<IfModule  mod_php7.c>
    #
    # Cause the PHP interpreter to handle files with a .php extension.
    #
    <FilesMatch \.(php|phar)$>
        SetHandler application/x-httpd-php
    </FilesMatch>

    #
    # Uncomment the following lines to allow PHP to pretty-print .phps
    # files as PHP source code:
    #
    #<FilesMatch \.phps$>
    #    SetHandler application/x-httpd-php-source
    #</FilesMatch>

    #
    # Apache specific PHP configuration options
    # those can be override in each configured vhost
    #
    php_value session.save_handler "files"
    php_value session.save_path    "/var/lib/php/mod_php/session"
    php_value soap.wsdl_cache_dir  "/var/lib/php/mod_php/wsdlcache"

    #php_value opcache.file_cache   "/var/lib/php/mod_php/opcache"
</IfModule>

Best Answer

To get back, it's quite simple:

1) Uninstall php-fpm or stop it:

sudo yum remove php72u-fpm.x86_64 php72u-fpm-httpd.noarch

OR

sudo systemctl stop php-fpm

2) Install mod_php again

sudo yum install mod_php72u.x86_64

3) Configure which listener httpd will use. The configuration file shows that prefork must be used /etc/httpd/conf.modules.d/15-php.conf contains this:

# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
  <IfModule prefork.c>
    LoadModule php7_module modules/libphp7.so
  </IfModule>
</IfModule>

In /etc/httpd/conf.modules.d/00-mpm.conf comment out

#LoadModule mpm_event_module modules/mod_mpm_event.so

and open up LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

4) Restart Apache/httpd

sudo systemctl restart httpd

Spoiler alert: from brief testing it wasn't php-fpm so now I have to figure out what's actually causing the slowness.