Php.ini per domain not used with Nginx + FPM, only global one

SYSTEM INFORMATION
OS type and version Fedora 39
Webmin version 2.105
Virtualmin version 7.8.2
Related packages Nginx, PHP 8.2.13

Per domain php.ini files are created automatically, but not used, say phpinfo().

check in nginx sites_enabled.conf IIR there should be a setting in there.

something like:

location ~ "\.php(/|$)" {
		default_type text/plain;
		try_files $uri $fastcgi_script_name =404;
	}

/usr/libexec/webmin/phpini/config

php_ini=/etc/php.ini,/etc/*/*/php*/php.ini,/etc/*/*/*php*/php.ini=Configuration for CLI and CGI /etc/php-fpm.conf,/etc/*/php*/php-fpm.conf,/etc/*/*/php*/php-fpm.conf=Configuration for FPM

/etc/nginx/nginx.conf

server {
server_name myvirtualminservername.com
location ~ "\.php(/|$)" {
                        try_files $uri $fastcgi_script_name =404;
                        default_type application/x-httpd-php;
                        fastcgi_pass unix:/var/php-fpm/170212899010168.sock;

As I know, different php.ini can passed to php-fpm service (/usr/lib/systemd/system/php-fpm.service ) by adding -c /home/mysite/etc/php.ini to ExecStart statement.
Is virtualmin use this way too ?
Also, I don’t see any “nginx” word in php-lib.pl , only Apache in save_domain_php_mode function.

I wonder if this has something to do with it. Or the lack of specific ref to the webserver in php-lib

my guess – FPM only uses the main /etc/php.ini (or wherever it lives) and then reads the individual php-fpm CONF files, such as /etc/php-fpm.d/123456789.conf

where the number is the Virtualmin Virtual Server Domain ID.

the VirtServer – Services – PHP-FPM Configuration panel (note this admin path changed (the menu labeling) slightly with Virtualmin 7.9 – in 7.9 its VirtServer – Web Configuration – PHP-FPM Configuration) with its Resource Limits section can adjust a few things that end up in that CONF file. Brave souls can edit that CONF file by hand to add additional items, of course be careful as it may be possible manual edit errors could cause the php-fpm service daemon to not be able to restart – which will affect every website using that version of PHP.

HOWEVER – my limited experience is all with apache, so some of this may not apply to Nginx. Also note if you have multiple versions of php and php-fpm installed, each version has its own daemon and its own set of domain specific CONF files.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.