How do I configure the PHP memory limit?

Due to the number of fields that are sometimes present in the admin, it may be necessary to adjust the PHP max_input_vars value. The default of 1,000 fields can be too small when managing a product that contains hundereds of variants. This limit is quickly reached when considering how many fields each variant has.

Data will be truncated by the server

A form that contains more fields than PHP is configured to accept will result in lost or corrupted data.

The max_input_vars value is defined in the php.ini file. On a Linux server, this is typically located:

# PHP 7.3
/etc/php/7.3/php-fpm/php.ini

# PHP 7.4
/etc/php/7.4/php-fpm/php.ini

# PHP 8.0
/etc/php/8.0/php-fpm/php.ini

On macOS when using Homebrew:

# PHP 7.3
/usr/local/etc/php/7.3/php.ini

# PHP 7.4
/usr/local/etc/php/7.4/php.ini

# PHP 8.0
/usr/local/etc/php/8.0/php.ini

We recommend a value of 10,000. You should either search for the existing entry, or add to the bottom of the file:

max_input_vars=10000

Once set, you'll need to reload PHP-fpm.

# Linux (PHP 7.3)
sudo service php7.3-fpm reload

# Linux (PHP 7.4)
sudo service php7.4-fpm reload

# Linux (PHP 8.0)
sudo service php8.0-fpm reload

# macOS (Laravel Valet)
valet restart

Articles in this section

Was this article helpful?
0 out of 0 found this helpful