# memory_limit default

- Thread: https://externals.io/message/74920
- Original archive: https://news-web.php.net/php.internals/74920
- Started by Pascal Chevrel on 2014-06-16T11:50:51+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #74920 — Pascal Chevrel — 2014-06-16T11:50:51+00:00

URL: https://externals.io/message/74920#74920

Hi internals people,

I was curious to know why the memory limit in php.ini was set to 128MB 
so I digged into the repository history and I saw that it was bumped 
from 16MB to that value in 2006: 
https://github.com/php/php-src/commit/3ffc1c8f4a1e4c1658f94038e009e226258a65a4#diff-299b21e0851494929e62b81e8d91b5b3

Since there is no reference to a bug in the commit and I couldn't find 
anything about it on the net, I thought I would ask at the source in 
internals.

Was it changed because the defaut value was too low for PHP to work 
correctly? Or was the change done to reflect the state of hosting 
solutions back then? I am curious to know why 128 and not 64 or 256 
actually. If this is the result of an analysis of the state of hosting, 
I am also wondering if 8 years later php.ini settings that depend on 
hardware like memory are still the right defaults.

Thanks for your hindsight on this!

Pascal

---

## #74921 — Ferenc Kovacs — 2014-06-16T12:16:30+00:00

URL: https://externals.io/message/74920#74921 · In reply to: #74920

On Mon, Jun 16, 2014 at 1:50 PM, Pascal Chevrel <pascal.chevrel@free.fr>
wrote:

> Hi internals people,
>
> I was curious to know why the memory limit in php.ini was set to 128MB so
> I digged into the repository history and I saw that it was bumped from 16MB
> to that value in 2006: https://github.com/php/php-src/commit/
> 3ffc1c8f4a1e4c1658f94038e009e226258a65a4#diff-
> 299b21e0851494929e62b81e8d91b5b3
>
> Since there is no reference to a bug in the commit and I couldn't find
> anything about it on the net, I thought I would ask at the source in
> internals.
>
> Was it changed because the defaut value was too low for PHP to work
> correctly? Or was the change done to reflect the state of hosting solutions
> back then? I am curious to know why 128 and not 64 or 256 actually. If this
> is the result of an analysis of the state of hosting, I am also wondering
> if 8 years later php.ini settings that depend on hardware like memory are
> still the right defaults.
>
> Thanks for your hindsight on this!
>
> Pascal
>
>
> --
> 
> 
>
>
adding Dmitry to the thread.


-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

---

## #74922 — Peter Cowburn — 2014-06-16T12:53:28+00:00

URL: https://externals.io/message/74920#74922 · In reply to: #74920

> Hi internals people,
>
> I was curious to know why the memory limit in php.ini was set to 128MB so
> I digged into the repository history and I saw that it was bumped from 16MB
> to that value in 2006: https://github.com/php/php-src/commit/
> 3ffc1c8f4a1e4c1658f94038e009e226258a65a4#diff-
> 299b21e0851494929e62b81e8d91b5b3
>
> Since there is no reference to a bug in the commit and I couldn't find
> anything about it on the net, I thought I would ask at the source in
> internals.
>
> Was it changed because the defaut value was too low for PHP to work
> correctly? Or was the change done to reflect the state of hosting solutions
> back then? I am curious to know why 128 and not 64 or 256 actually. If this
> is the result of an analysis of the state of hosting, I am also wondering
> if 8 years later php.ini settings that depend on hardware like memory are
> still the right defaults.
>

See a (public) discussion from 2006 at
http://php.markmail.org/thread/kw7yzcr37j4xi7ab


>
> Thanks for your hindsight on this!
>
> Pascal

---

## #74923 — Dmitry Stogov — 2014-06-16T13:19:01+00:00

URL: https://externals.io/message/74920#74923 · In reply to: #74920

hi Pascal,

There are few reasons:

- PHP applications became more fat. (near everyone now uses some framework)
- PHP was optimized to use more memory from controlled memory area instead
of system heap
- PHP introduced different caches that takes memory in cost of better
performance
- Some new features increased the size of some basic structures (e.g.
zend_class_entry) and it made PHP consume more memory
- RAM became much chipper

We did some analyzes that time, but I can't remember what exactly.

In any case, if you speak about shared hosting, you should configure PHP
careful and change the default settings according to amount of available
RAM, expected number of PHP processes and expected average memory
consumption.

Thanks. Dmitry.


On Mon, Jun 16, 2014 at 3:50 PM, Pascal Chevrel <pascal.chevrel@free.fr>
wrote:

> Hi internals people,
>
> I was curious to know why the memory limit in php.ini was set to 128MB so
> I digged into the repository history and I saw that it was bumped from 16MB
> to that value in 2006: https://github.com/php/php-src/commit/
> 3ffc1c8f4a1e4c1658f94038e009e226258a65a4#diff-
> 299b21e0851494929e62b81e8d91b5b3
>
> Since there is no reference to a bug in the commit and I couldn't find
> anything about it on the net, I thought I would ask at the source in
> internals.
>
> Was it changed because the defaut value was too low for PHP to work
> correctly? Or was the change done to reflect the state of hosting solutions
> back then? I am curious to know why 128 and not 64 or 256 actually. If this
> is the result of an analysis of the state of hosting, I am also wondering
> if 8 years later php.ini settings that depend on hardware like memory are
> still the right defaults.
>
> Thanks for your hindsight on this!
>
> Pascal
