51

I'd like to determine the current config that is 'loaded'. These would be all the values listed here: http://php.net/manual/en/install.fpm.configuration.php

These values are not returned by phpinfo().

yivi
  • 42,438
  • 18
  • 116
  • 138
Chris Stryczynski
  • 30,145
  • 48
  • 175
  • 286

4 Answers4

65

If you have access to server, try, depending on php version

sudo php-fpm7.0 -tt
sudo php-fpm7.x -tt
sudo php-fpm7.4 -tt
sudo php-fpm8.0 -tt
sudo php-fpm8.1 -tt
sudo php-fpm8.2 -tt

It test the current config file and show config params values (also default ones).

The displayed values can differs from current running config if a modification happened and php-fpm hasn't been reloaded.

Only tested out on php-fpm 8.1

Note: Output from the command goes to standard error and that makes piping to something like grep or less inconvenient. To account for this:

php-fpm8.2 -tt 2>&1 | grep access
Axi
  • 1,534
  • 15
  • 20
  • 1
    Emphasis on: "The `displayed values` can differs from `current running config` if a modification happened and php-fpm hasn't been reloaded." – famzah Oct 02 '20 at 09:15
  • `php-fpm7.4: command not found` – Avatar Mar 13 '23 at 14:51
  • you should try to find out which php version you're using first @Avatar – Axi Mar 14 '23 at 15:31
  • Within a Docker container based on a `php:x.x.x-fpm` image no need to specify the version just type `php-fpm -tt`. – Martin Tovmassian Apr 21 '23 at 10:04
  • it doesn't need `sudo` and probably doesn't need version number❗— If on a server with a single specific version installed, the command to run is 90% of the times: `php-fpm -tt`. – Kamafeather Jun 08 '23 at 11:58
11

There are two ways to check it out, as far as I know

  1. use ps command to locate the fpm config file and read it
root@c56686e9854c:/# ps aux | grep php-fpm  | grep master

root 1 0.0 0.9 455112 37324 ? Ss 12:01 0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf)

  1. use php-fpm's own command
root@c56686e9854c:/# php-fpm -tt

[29-Mar-2020 12:31:23] NOTICE: [www]

...

[29-Mar-2020 12:31:23] NOTICE: pm = dynamic

[29-Mar-2020 12:31:23] NOTICE: pm.max_children = 5

[29-Mar-2020 12:31:23] NOTICE: pm.start_servers = 2

[29-Mar-2020 12:31:23] NOTICE: pm.min_spare_servers = 1

[29-Mar-2020 12:31:23] NOTICE: pm.max_spare_servers = 3

...

Randy Lam
  • 579
  • 5
  • 11
7

Axi's solution is not complete, in that the -tt flag merely displays the values of the current config files as they exist on the filesystem, not the values that are currently loaded into memory. These values may not necessarily be the same. For example, if an edit was made to the file, but fpm was not reloaded.

The best solution I found was to enable the FPM Status Page in Apache or Nginx. Although it doesn't display all variables, it's better than nothing.

vtim
  • 81
  • 1
  • 3
  • 1
    I added a precision on my post as it seems it wasn't clear enough – Axi Apr 03 '19 at 08:41
  • 1
    Sadly, even this doesn't show the runtime configuration for "pm.max_children" or "pm.min_spare_servers", for example. – famzah Oct 02 '20 at 09:36
-4

You can use:

parse_ini_file(php_ini_loaded_file())
Code Spirit
  • 3,992
  • 4
  • 23
  • 34
  • 2
    This doesn't show you settings like pm.max_children or pm.min_spare_servers, pm.max_spare_servers, etc. – S. Imp Feb 05 '19 at 23:50