# PHP Fatal error: Allowed memory size - ignoring php.ini ???

## DNAspark99

I've got a script encountering an 'alternate' php memory_limit 

```
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes)
```

(as demonstrated by a lower setting) in:

/etc/php/apache2-php5/php.ini : 

```
memory_limit = 128M
```

Any idea as to why/how is it ignoring the setting in php.ini ? (and yes of course apache has been restarted after changes to php.ini)

For the record, I'm actually trying to *increase* the limit as well.

This is with dev-lang/php-5.2.6-r7. 

Any ideas?

----------

## DNAspark99

even setting the following in .htaccess:

```
php_value memory_limit 8M
```

phpinfo(); reports the 8M local limit

yet all scripts seem to be ignoring any limit (until they hit this mysterious 256M limit)

```
ulimit -a
```

Throwing ulimit into a script reports :

```
max memory size (kbytes, -m) unlimited
```

 

----------

## cach0rr0

possible to share the responsible code? 

have any ini_set within your code that might be altering memory_limit?

----------

## DNAspark99

can't really share the code, but it's basically a search with a timeframe variable. If the search parameters are 'wide' enough, apparently it's (legitimately) going to require 256M+ , yet any and all changes being made (even for other vhosts running other code) it seems it is completely ignoring php.ini's memory_limit (and then when it hits 256M, php fatal error results.)

----------

## DNAspark99

hrm, odd, it appears a 'stop & start' of apache, rather than a restart, has caused it to recognize the php.ini setting!

----------

## cach0rr0

hanging worker process? weird.

----------

## St3v3

heres some good info in the subject:

http://drupal.org/node/207036

----------

