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

**URL:** <https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988>\
**Category:** Questions\
**Created:** [March 31, 2020, 9:46pm UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988 "2020-03-31T21:46:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevecoug](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@stevecoug](https://discourse.slimframework.com/u/stevecoug)\
**Post date:** [March 31, 2020, 9:46pm UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988/1 "2020-03-31T21:46:07Z")

</div>

I have the following code:

```
use Slim\Factory\AppFactory;
$app = AppFactory::create();
$app->run();

```

I call it with this URL:  
[https://localhost:8443/api2/test/asdf/asdfasdfasdfasdf/asdfasdf/asdfasdf](https://localhost:8443/api2/test/asdf/asdfasdfasdfasdf/asdfasdf/asdfasdf)

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):  
[https://localhost:8443/api2/test/a/s/d/f](https://localhost:8443/api2/test/a/s/d/f)

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

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [March 31, 2020, 10:15pm UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988/2 "2020-03-31T22:15:02Z")

</div>

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

```php
<?php
// public/index.php

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

use Slim\Factory\AppFactory;

$app = AppFactory::create();
//$app->setBasePath('/my-sub-directory');

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

$app->run();

```

---

<div class="post-metadata">

**Author:** ![stevecoug](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@stevecoug](https://discourse.slimframework.com/u/stevecoug)\
**Post date:** [March 31, 2020, 10:22pm UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988/3 "2020-03-31T22:22:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [March 31, 2020, 10:51pm UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988/4 "2020-03-31T22:51:08Z")

</div>

> [@stevecoug](#):
>
> Did you try it with the longer path I had trouble with?

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

---

<div class="post-metadata">

**Author:** ![stevecoug](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@stevecoug](https://discourse.slimframework.com/u/stevecoug)\
**Post date:** [April 1, 2020, 2:44am UTC](https://discourse.slimframework.com/t/resolved-running-out-of-memory-when-long-urls-are-passed-in/3988/5 "2020-04-01T02:44:20Z")

</div>

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!
