Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ad-inserter domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the cookie-law-info domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/blog.webeats.it/httpdocs/wp-includes/functions.php on line 6114
nginx: fix 413 Request Entity Too Large - Blog WebEats

Fixare l’errore al momento del caricamento di un file troppo grande su ubuntu 16.04 con PHP-FPM+nginx. fix 413 Request Entity Too Large modificando le impostazioni di nginx e php.ini

Questo errore si verifica quando si tenta di caricare un file più grande delle impostazioni di upload impostate in nginx e nel file php.ini. Vediamo in pochi passi come risolvere questo piccolo problema. Il sistema di riferimento è Ubuntu 16.04

Step 1: fix client_max_body_size nel file nginx.conf

Per risolvere questo problema serve editare il file nginx.conf in /etc/nginx/ con il comando

nano /etc/nginx/nginx.conf

ora cerchiamo o aggiungiamo la riga

client_max_body_size 2M;

e impostiamo il valore che vogliamo, ad esempio 25M. Diventerà quindi:

client_max_body_size 25M;

Riavviamo nginx con

service nginx restart

Step 2: fix upload value nel php.ini

Sistemiamo ora anche il file php.ini

Ipotizziamo di lavorare con la combo PHP-FPM+nginx, il file da editare nel nostro caso sarà in /etc/php/7.0/fpm/php.ini. Le variabili da modificare sono le seguenti

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M

;The maximum size of an uploaded file.
upload_max_filesize = 25M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 30M

Una volta modificate, salviamo il file e riavviamo anche php-fpm con il comando

service php7.0-fpm restart

Ora potremo caricare tranquillamente file grandi fino a 25MB

ATTENZIONE: questo errore potrebbe verificarsi anche in caso di permessi errati. Diamo sempre anche uno sguardo ai log del nostro sito web 🙂