I have an Apache server with an outbound transfer limit of 6 GB. In a PHP script I accidentally ran a loop that outputted an enormous amount of data and used almost all of my allocated bandwidth.

Is there a way I can limit each request to only output 10 MB of data and then either kill the process or let it run but don't output anything else, to avoid such problems in the future ?

Here's what a problematic request looks like in the log :

```
xxx.xxx.xxx.204 - - [16/Jan/2015:16:10:01 +0100] "GET /ebok/ebok.php HTTP/1.1" 200 5368709120 "-" "Wget/1.13.4 (linux-gnu)"

```

I tried with ini\_set

```
<?php
ini_set('memory_limit', '1M');
$a = array();
for($x=1; $x<1000; $x++) {
    array_push($a, array('imie'=>'Pablo'.$x, 'nazwisko'=>'picasso'.$x,     'adres'=>'nowowiejska'.$x));
}
print_r($a);
exit;
?>

```

and I get message:

```
Fatal error:  Allowed memory size of 1048576 bytes exhausted (tried to allocate 72 bytes) in /home/public_html/bench.php on line 5

```

but in apache log it takes only 10KB

```
xxx.xxx.xxx.134 - - [16/Jan/2015:23:25:50 +0100] "GET /bench.php HTTP/1.1" 200 11146 "-" "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"

```

What I do wrong?