GoAdmio

disablefpm

Turn off PHP-FPM for every account and switch the server to mod_php

On this page: Overview · Quick start · Syntax · Output · Examples · Troubleshooting · Details · See also


Overview

/go/disablefpm stops the server from running each account's PHP through its own PHP-FPM pool, and switches Apache to run PHP itself through mod_php. It:

It works only on Apache servers on AlmaLinux, Rocky, CentOS, Red Hat, and Fedora. Nginx servers and Debian or Ubuntu servers need PHP-FPM, so the command refuses to run there.

[!WARNING] This changes every account on the server, and the deleted pool files are not backed up. Plan for a short period of errors on your sites, and test one site as soon as it finishes. With mod_php, Apache loads a single PHP version for all sites, so per-domain PHP versions set with multiphp no longer apply. Every site uses the server's default version (see defaultphp). PHP also runs as the web server's user instead of each account's own user.


Quick start

/go/disablefpm

Syntax

/go/disablefpm

The command takes no options. Any arguments you pass are only recorded in the log, and they change nothing.

Run it as root. It asks for no confirmation.


Output

The command prints nothing of its own when it succeeds. Any output on screen comes from the commands it runs (conf, go, and fpm).

Message Meaning
PHP-FPM Required By NGINX The server uses Nginx. Nothing is changed. Exit status 1.
PHP-FPM Required By Debian & Ubuntu The server runs Debian or Ubuntu. Nothing is changed. Exit status 1.

Examples

# Before: keep copies in case you need to go back
sudo cp -a /var/lib/sqlite/site.db /root/site.db.bak
sudo cp -a /etc/opt/remi /root/remi-backup

# Switch to mod_php
/go/disablefpm
# Check that no account still has PHP-FPM turned on
sudo sqlite3 /var/lib/sqlite/site.db "SELECT COUNT(*) FROM Site WHERE FPM=1"
# Check that Apache has a PHP module loaded
httpd -M | grep -i php

Troubleshooting

Symptom Likely cause Fix
PHP-FPM Required By NGINX The server runs Nginx. Convert to Apache with apache first, or keep PHP-FPM.
PHP-FPM Required By Debian & Ubuntu These systems are not supported. Keep PHP-FPM.
.php files are shown as text or offered for download Apache has no PHP module loaded. Check with httpd -M | grep -i php, install or enable the PHP module, then reload Apache with reload.
A site uses a different PHP version than before mod_php loads one version for every site. Set the server version with defaultphp.
Permission errors appear on uploads or file writes PHP now runs as the web server's user. Check the file and folder permissions with fix.
Some pool files are still on disk Only the pool files under /etc/opt/remi are deleted. Pools for the default PHP in /etc/php-fpm.d are not touched. Remove them by hand if you don't need them.
I want PHP-FPM back The command can't be undone in one step. The setting is cleared for every account and the pool files are deleted. Restore the copies you made before running it, or re-create the pools and turn PHP-FPM back on for each site.

Details

What it does

flowchart TD
    A["disablefpm"] --> B{"Web server is Nginx?"}
    B -- "Yes" --> X1["Print PHP-FPM Required By NGINX, exit 1"]
    B -- "No" --> C{"Debian or Ubuntu?"}
    C -- "Yes" --> X2["Print PHP-FPM Required By Debian and Ubuntu, exit 1"]
    C -- "No" --> D["Set FPM=0 for every site in the database"]
    D --> E["Rebuild the web server configuration with conf"]
    E --> F["Delete pool files in /etc/opt/remi except www.conf"]
    F --> G["Run go"]
    G --> H["Restart PHP-FPM with fpm"]

Steps, in order

  1. Appends the call to /var/log/go/disablefpm.log.
  2. Stops with an error if the web server is Nginx, or the OS is Debian or Ubuntu.
  3. Sets FPM=0 for every row in the Site table of /var/lib/sqlite/site.db. There is no filter, so all accounts are affected.
  4. Rebuilds the web server configuration with conf.
  5. Deletes every file in /etc/opt/remi/*/php-fpm.d except www.conf. These are the per-domain pool files for each installed Remi PHP version.
  6. Runs /go/go.
  7. Runs fpm with a note that it was started by disablefpm.

Any operating system other than Debian or Ubuntu is treated as the Red Hat family, so the command also continues on an unrecognized OS.

Side effects


See also

Command Description
fpm Restart all installed PHP-FPM versions on your server
multiphp Manage PHP versions per domain
defaultphp Show or change the server's default PHP version
conf Rebuild the Apache/Nginx configuration in GoAdmio
apache Convert a GoAdmio server from Nginx to Apache
fix Fix GoAdmio file and folder permissions
restart Restart all PHP-FPM pools and the active web server