Overview
In Omeka S, I encountered an issue where the error message “CSRF: Value is required and can’t be empty” was displayed when trying to save an item associated with many media, and saving would not complete.

This article explains how to address this error.
Related Articles
This is mentioned in articles such as the following. It appears to be a known error, and it is stated that php.ini needs to be modified.
https://forum.omeka.org/t/csrf-value-is-required-and-cant-be-empty/15421
https://github.com/omeka/omeka-s/issues/1472
Solution
Below is the response from ChatGPT.
To set max_input_vars in php.ini, follow these steps:
Open the
php.inifile. The location ofphp.inivaries depending on your environment, but it is commonly found in one of the following directories:/etc/php/8.x/apache2/php.ini(Apache)/etc/php/8.x/cli/php.ini(CLI)/etc/php/8.x/fpm/php.ini(PHP-FPM)
Set or change the value of
max_input_vars. Look for the following line. If it does not exist, add it as a new line.
The value 1000 is the default, but you can change it to a larger number as needed. For example, to change it to 5000:
Save the
php.inifile.Restart the web server to apply the settings. For example, if you are using Apache, run the following command:
If you are using PHP-FPM, run:
This sets max_input_vars and the web server will reflect the setting.
Summary
In this case, setting max_input_vars = 5000 resolved the above error.
I hope this is helpful for those experiencing the same issue.