# realpath_cache_size description in php.ini

- Thread: https://externals.io/message/68888
- Original archive: https://news-web.php.net/php.internals/68888
- Started by Bostjan Skufca on 2013-09-04T18:28:40+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

---

## #68888 — Bostjan Skufca — 2013-09-04T18:28:40+00:00

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

Hi all,

there is no description to be found about what the value of
realpath_cache_size actually is.

Is it
a) max number of files/dirs in the cache or
b) overall cache size?

I checked php.ini samples distributed with PHP 5.5.3, and documentation
here:
http://php.net/realpath-cache-size

Can please someone here provide an answer?
Documentation and php.ini update would be nice too :)

b.

---

## #68894 — Julien Pauli — 2013-09-05T09:06:52+00:00

URL: https://externals.io/message/68888#68894 · In reply to: #68888

> Hi all,
>
> there is no description to be found about what the value of
> realpath_cache_size actually is.
>
> Is it
> a) max number of files/dirs in the cache or
> b) overall cache size?
>
> I checked php.ini samples distributed with PHP 5.5.3, and documentation
> here:
> http://php.net/realpath-cache-size
>
> Can please someone here provide an answer?
> Documentation and php.ini update would be nice too :)
>

This is a little bit complicated.
The size represent the total number of bytes in the overall paths stored +
some garbage.
So if realpath cache stores an entry of say "/tmp/foo/bar.baz", then it
will add 16 bytes to the realpath cache size.
i.e, the longer the paths, the higher the cache size should be.
The formula is located at
http://lxr.php.net/xref/PHP_TRUNK/TSRM/tsrm_virtual_cwd.c#643

The `realpath_cache_size()` PHP function documentation says "Returns how much
memory realpath cache is using." , and this is actually true, though it
could be more accurate on how this memory is calculated.
The realpath_cache_size INI description is "Determines the size of the
realpath cache to be used by PHP. This value should be increased on systems
where PHP opens many files, to reflect the quantity of the file operations
performed." It's not very specific either, I admit.

Julien.Pauli

---

## #68896 — Chris Wright — 2013-09-05T10:29:52+00:00

URL: https://externals.io/message/68888#68896 · In reply to: #68894

> 
>
> > […]
>
> This is a little bit complicated.
> The size represent the total number of bytes in the overall paths stored + some
> garbage.
> So if realpath cache stores an entry of say "/tmp/foo/bar.baz", then it will
> add 16 bytes to the realpath cache size.
> i.e, the longer the paths, the higher the cache size should be.
> The formula is located at
> http://lxr.php.net/xref/PHP_TRUNK/TSRM/tsrm_virtual_cwd.c#643
>
> The `realpath_cache_size()` PHP function documentation says "Returns how much
> memory realpath cache is using." , and this is actually true, though it could be
> more accurate on how this memory is calculated. The realpath_cache_size INI
> description is "Determines the size of the realpath cache to be used by PHP.
> This value should be increased on systems where PHP opens many files, to reflect
> the quantity of the file operations performed." It's not very specific either,
> I admit.

> Julien.Pauli

I've updated the docs for the config option to reflect Julien's explanation, and
added a link to the config option docs from the function docs

---

## #68898 — Julien Pauli — 2013-09-05T11:57:36+00:00

URL: https://externals.io/message/68888#68898 · In reply to: #68896

On Thu, Sep 5, 2013 at 12:29 PM, Chris Wright <chrisw@aquacool.ltd.uk>wrote:

> On Thu, Sep 5, 2013 at 10:07 AM, Julien Pauli < julienpauli@gmail.com >
> wrote:
> > […]
> + some
> > […]
> will
> > […]
> much
> > […]
> could be
> > […]
> INI
> > […]
> PHP.
> > […]
> reflect
> > […]
> either,
> > […]
>
> > […]
>
> I've updated the docs for the config option to reflect Julien's
> explanation, and
> added a link to the config option docs from the function docs
>

Thx Chris, I didn't know if it were worth doing it, but you added the info,
so it is cool. Thank you.

Julien.Pauli
