NGINX, PHP-FPM und memory_limit
Das Memory Limit für PHP in der Konfiguration von NGINX und PHP-FPM einstellen
In PHP-FPM ist memory_limit standardmäßig auf 128MB gesetzt. Wenn dieses Limit geändert werden muss, lässt sich der gewünschte Wert über die Direktive fast_cgi_param setzen:
fastcgi_param PHP_VALUE "memory_limit = 1G";
Für eine Symfony-Anwendung kann die Konfiguration dann zum Beispiel so aussehen:
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PHP_VALUE "memory_limit = 1G";
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}