Programster's Blog

Tutorials focusing on Linux, programming, and open-source

PHP FPM Settings/Configuration Order

I recently had an issue whereby we couldn't figure out why our additional custom php.ini configuration file that was configuring where the log file should be placed, was having no effect. It turns out that we were setting an additional php.ini file, instead of editing or adding one of the PHP FPM config files that override those settings.

The easiest way to explain and show this is with the diagram below, where settings "cascade" with the boxes towards the bottom overriding the settings that came before. Thus, if you ever run into similar sorts of issues yourself, be sure to check the other configuration files represented by the boxes that are further down in the waterfall.

Not all PHP options can be specified in the FPM configuration, but error_log is one of them. Thus it is worth checking the list of PHP FPM configuration options for the overlaps.

Checking Settings On Server

To check the loaded settings files and the configured settings, you can output these on your web server by placing this at the top of a debug info page.


If you need to capture the output, then you can use output buffering like so:

function getPhpInfo() : string
    return ob_get_clean();
Last updated: 25th June 2024
First published: 14th June 2024