RESOLVED: Running out of memory when long URLs are passed in

I have the following code:

use Slim\Factory\AppFactory;
$app = AppFactory::create();

I call it with this URL:

My Apache server then crashes:
[crit] Memory allocation failed, aborting process.
[Tue Mar 31 15:34:05.903418 2020] [core:notice] [pid 1] AH00052: child pid 265 exit signal Aborted (6)

If I call it with this URL instead, it returns a 404 (as expected):

This is with Slim 4.4.0 running on PHP 7.3.16 and Apache 2.4.

I have a similar setup and it works without problems.

  • Add the composer autoloader
  • Make sure that you have created the correct .htaccess file(s) in the correct directories
  • Add at least one route
  • Make sure that the base path is set correctly
// public/index.php

require_once __DIR__ . '/../vendor/autoload.php';

use Slim\Factory\AppFactory;

$app = AppFactory::create();

$app->get('/api2/test/a/s/d/f', function ($request, $response) {
    return $response;


I took out all the routes as I was trimming it down to the minimum needed to cause the crash. I had routes before.

Did you try it with the longer path I had trouble with?

Yes, and it works like expected (error 404).

It turns out that when I remove ALL of the Slim code, it still happens, so it must be between Apache and PHP. Sorry to have bothered you!