How Do I Increase Max_Input_Vars On PHP-FPM?

sharingsunshine
sharingsunshine used Ask the Experts™
on
I need to increase max_input_vars on an Apache 2.4, Amazon Linux with PHP 7.2 that is running php-fpm to 3000.  I changed php.ini restarted php-fpm and apache but there is no change.

Where do I make the change so that max_input_vars is changed?

Here is a screenshot of php info

https://gyazo.com/e1242115eabae9cc0b870bc7f9ab2ca3
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
I normally set the following on in all my site php.ini files.

max_input_vars = 10000

Open in new window


The default is 100, which rarely works on sites these days.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Where this file lives is Distro dependent.

Check something like one of these...

/etc/php/fpm/php.ini
/etc/php/$version/fpm/php.ini

Open in new window

Author

Commented:
there isn't anything  in /etc with a php directory.  However, there is this file but nothing about vars in it.

[root@ip-172-31-8-214 etc]# cat php-fpm.conf
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix.

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/etc/php-fpm.d/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Default Value: none
;pid = /run/php-fpm/php-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Default Value: /var/log/php-fpm.log
error_log = /var/log/php-fpm/error.log

; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon

; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated.  This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0

; The maximum number of processes FPM will fork. This has been designed to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
;process.max = 128

; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lowest priority)
; Note: - It will only work if the FPM master process is launched as root
;       - The pool process will inherit the master process priority
;         unless specified otherwise
; Default Value: no set
;process.priority = -19

; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = yes

; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024

; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

; Specify the event mechanism FPM will use. The following is available:
; - select     (any POSIX os)
; - poll       (any POSIX os)
; - epoll      (linux >= 2.5.44)
; Default Value: not set (auto detection)
;events.mechanism = epoll

; When FPM is built with systemd integration, specify the interval,
; in seconds, between health report notification to systemd.
; Set to 0 to disable.
; Available Units: s(econds), m(inutes), h(ours)
; Default Unit: seconds
; Default value: 10
;systemd_interval = 10

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different listening
; ports and different management options.  The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)

; See /etc/php-fpm.d/*.conf

Open in new window

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Fractional CTO
Distinguished Expert 2018
Commented:
The above is the FPM config file, rather than the per process PHP config file (which is what you're looking for).

Try this...

find /etc -type f -exec egrep -il -e memory_limit -e max_input_vars -e post_max_size {} \;

Open in new window


This will find any file with one of several common PHP settings which normally show up in php.ini files, so whatever file(s) show up will be the candidates for where to change your settings.

Be sure to run a phpinfo.php file before + after you change your settings, to ensure you actually have the correct file identified.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
If you get completely stumped, do this...

# in one window
inotifywait -mrq /etc | grep php

# in another window
service service php7.2-fpm restart

Open in new window


You'll see every file touched by the FPM start process when you do this + you'll know for sure what files get read at startup.

Note: service service php7.2-fpm restart may be very different with your Distro. Refer to your docs for how to do this.

Author

Commented:
Thanks for your help.

I get this on the find command

/etc/php.ini
/etc/php-fpm.d/www.conf

Open in new window


it appears I should look at www.conf

I added this line php_value[max_input_vars] = 3000 and restarted php-fpm and it worked.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
Great!

Don't think you're alone in having challenges finding php.ini files these days.

With all the variations of Distro + FPM variants + PHP versions.

Finding this file can sometimes be a chore.

Hang in there!

Author

Commented:
Thanks again, no worries I am not going anywhere.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial