• malte1979

    (@malte1979)


    I am working on a server with two WordPress sites (v5.9) and multiple other services. Everything is served with Apache (v2.4.6).

    Now I am about to create a new PHP service, which should also being talked to via Apache. Therefore I would like to migrate from Apache php_module (PHP 7.2) to php_fpm and mod_proxy_fcgi.

    There are plenty of tutorials and docs for both ways of using Apache, PHP and WordPress, but I did not see any hints for this kind of migration.

    What do need to be aware of? Where are the pitfalls?

    Here is my current Apache configuration

    php.conf:

    #
    # The following lines prevent .user.ini files from being viewed by Web clients.
    #
    <Files ".user.ini">
        <IfModule mod_authz_core.c>
            Require all denied
        </IfModule>
        <IfModule !mod_authz_core.c>
            Order allow,deny
            Deny from all
            Satisfy All
        </IfModule>
    </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/session"
        php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"
    
        #php_value opcache.file_cache   "/var/lib/php/opcache"
    </IfModule>

    One of the WordPress sites as Apache Vhost:

    <Ifmodule mod_ssl.c>
    
    # Listen 443
    <VirtualHost *:443>
        DocumentRoot "/var/www/wp-cockpit.de/"
        ServerName wp-cockpit.de
        ServerAlias www.wp-cockpit.de
    
        <Directory "/var/www/wp-cockpit.de/">
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog "/var/log/httpd/webServer-error_log"
        CustomLog "/var/log/httpd/webServer-access_log" combined
    
        SSLEngine on
        # SSLCertificateFile /etc/letsencrypt/live/co2-avatar.com/fullchain.pem
        
        SSLCertificateFile /etc/letsencrypt/live/co2-avatar.com/cert.pem
        SSLCertificateChainFile /etc/letsencrypt/live/co2-avatar.com/chain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/co2-avatar.com/privkey.pem
        
        Include /etc/letsencrypt/options-ssl-apache.conf
    
        #SSLCertificateFile /etc/letsencrypt/live/co2-avatar.com/fullchain.pem
        #SSLCertificateKeyFile /etc/letsencrypt/live/co2-avatar.com/privkey.pem
        # SSLCertificateChainFile /etc/letsencrypt/live/co2-avatar.com/chain.pem
    </VirtualHost>
    </IfModule>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator threadi

    (@threadi)

    Your question concerns WordPress as an application only marginally. Because you have to pay much more attention to the server-side components for this kind of migration. You should rather ask your questions where people are familiar with the server system you are using. Here in the WordPress forum you could only point out the system requirements of WordPress that the server system you are using has to fulfill in some way.

    Dion

    (@diondesigns)

    The biggest thing you should be aware of is that your (very old) version of Apache doesn’t correctly support PHP-FPM. That was added in, I believe, Apache 2.4.9. In any case, the current version is 2.4.53 and includes a large number of improvements and security/bug fixes, so updating Apache should be the first thing you do. Also note that there were some fairly large improvements to PHP-FPM starting with the 7.3 branch, so give some thought to updating PHP as well.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Pitfalls for migration from apache php_module to fcgi?’ is closed to new replies.