@@ -277,6 +277,32 @@ or `[::]` IPv6 address like this:
277277$ X_LISTEN=0.0.0.0:8080 php public/index.php
278278```
279279
280+ ### Memory limit
281+
282+ X is carefully designed to minimize memory usage. Depending on your application
283+ workload, it may need anywhere from a few kilobytes to a couple of megabytes per
284+ request. Once the request is completely handled, used memory will be freed again.
285+ Under load spikes, memory may temporarily increase to handle concurrent requests.
286+ PHP can handle this load just fine, but many default setups use a rather low
287+ memory limit that is more suited for single requests only.
288+
289+ ```
290+ Fatal error: Allowed memory size of 134217728 bytes exhausted […]
291+ ```
292+
293+ When using the built-in web server, we highly recommend increasing the memory
294+ limit to match your concurrency workload. On Ubuntu- or Debian-based systems,
295+ you may change your PHP configuration like this:
296+
297+ ``` bash
298+ $ sudoedit /etc/php/8.1/cli/php.ini
299+ ```
300+
301+ ``` diff title="/etc/php/8.1/cli/php.ini"
302+ - memory_limit = 128M
303+ + memory_limit = -1
304+ ```
305+
280306### Systemd
281307
282308So far, we're manually executing the application server on the command line and
@@ -513,7 +539,8 @@ be achieved by using a `Dockerfile` with the following contents:
513539 && pecl install ev \
514540 && docker-php-ext-enable ev \
515541 && docker-php-ext-install sockets \
516- && apk del ${PHPIZE_DEPS}
542+ && apk del ${PHPIZE_DEPS} \
543+ && echo "memory_limit = -1" >> "$PHP_INI_DIR/conf.d/acme.ini"
517544
518545 WORKDIR /app/
519546 COPY public/ public/
0 commit comments