# zend_alter_ini_entry threadsave if used in SAPI modules?

- Thread: https://externals.io/message/1663
- Original archive: https://news-web.php.net/php.internals/1663
- Started by Uwe Schindler on 2003-05-18T13:36:24+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

---

## #1663 — Uwe Schindler — 2003-05-18T13:36:24+00:00

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

I am writing on an extension of the NSAPI SAPI module (see bug #8879) so 
that you can specify some overrides for php.ini entries at execution of a 
script from the webserver (like you can do it in apache).

I want to set the variables with
  zend_alter_ini_entry(..., PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
but this call have no reference to TSRM.

Can I use it or is it not thread save? e.g. if two requests to the 
webserver on two virtual servers run at the same time and each thread 
overwrites the doc_root property in php.ini can they coexist. Are 
PHP_INI_STAGE_RUNTIME settings only valid for one thread?

Looking at aolserver SAPI, the ini feature is commented out there because 
of thread safety...

Uwe

---

## #1664 — Zeev Suraski — 2003-05-18T13:40:25+00:00

URL: https://externals.io/message/1663#1664 · In reply to: #1663

At 16:36 18/05/2003, Uwe Schindler wrote:
>I am writing on an extension of the NSAPI SAPI module (see bug #8879) so 
>that you can specify some overrides for php.ini entries at execution of a 
>script from the webserver (like you can do it in apache).
>
>I want to set the variables with
>  zend_alter_ini_entry(..., PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME);
>but this call have no reference to TSRM.
>
>Can I use it or is it not thread save? e.g. if two requests to the 
>webserver on two virtual servers run at the same time and each thread 
>overwrites the doc_root property in php.ini can they coexist. Are 
>PHP_INI_STAGE_RUNTIME settings only valid for one thread?
>
>Looking at aolserver SAPI, the ini feature is commented out there because 
>of thread safety...

It should be thread safe.  Are you sure that the comment in aolserver.c is 
due to thread safety?

Zeev

---

## #1665 — Uwe Schindler — 2003-05-18T13:45:00+00:00

URL: https://externals.io/message/1663#1665 · In reply to: #1663

Look here:

         /*
          * Deactivated for now. The ini system will cause random crashes when
          * accessed from here (since there are no locks to protect the global
          * known_directives)
          */

My question was if the modifications to the ini values are valid only for 
one thread, so if the webserver runs two requests in two threads at the 
same time with different ini settings if they can see the modification of 
the other one...

At 16:40 18.05.2003 +0300, Zeev Suraski wrote:
>At 16:36 18/05/2003, Uwe Schindler wrote:
> > […]
>
>It should be thread safe.  Are you sure that the comment in aolserver.c is 
>due to thread safety?
>
>Zeev

---

## #1676 — Sascha Schumann — 2003-05-18T15:06:37+00:00

URL: https://externals.io/message/1663#1676 · In reply to: #1663

> Looking at aolserver SAPI, the ini feature is commented out there because
> of thread safety...

    That's an extremely old comment, maybe things have improved
    since then.

    - Sascha
