# php.ini values extension

- Thread: https://externals.io/message/33163
- Original archive: https://news-web.php.net/php.internals/33163
- Started by Piotr Wadas on 2007-11-15T18:38:37+00:00
- Messages: 1
- 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

---

## #33163 — Piotr Wadas — 2007-11-15T18:38:37+00:00

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

Hello,

I'm writing php extension to read php.ini settings from independent
location,
particularly some object or relational database, or, sleepycat db.
PHP ini development concept seems pretty straightforward to me,
anyway I can't figure out how to make a php.ini setting to be "admin
value",
e.g. not changeable with `ini_set()` function from within php script,
whatever
access type its definition has.
I looked into apache mod_php5 module source, to find out how
php_admin_value/flag is implemented, and it seems there's special
handler, different than "normal" variable change handler.

Type of php.ini variable access is controlled via third argument
to PHP_INI_ENTRY() macro, anyway php_admin_value implementation
overrides it somehow, I mean no matter what kind of access was
defined with the variable definition in php source, if the value
is set with php_admin_value, it is not changeable later, and
this is exactly what I want.

There's also a modification handler for php.ini variables, but
obviously this is also variable-definition setting, I mean, if
e.g. modfication handler for mysql.port is onUpdateString,
I cannot in my extension change it to OnOtherUpdateStringProcedure,
as mysql extension's php ini variables are already
defined in mysql extension source.

Anyway with mod_php php_admin_value/flag does
it somehow (make php ini variable unchangeable).

To be exact - I want to set any php.ini variable inside extension
code - and this is something I know how to do it -
and mark it to be "admin value" (not changeable later) - and this
is something I cannot figure out.

I actually use php as cgi/fcgi, and since I noticed, that
command-line specified variable (-d switch) is not automatically
marked as "admin value" (works according with variable access type).

The only one advanced php api information I could find was "Extending
and Embedding PHP" book,
written by Sara Golemon, anyway php.ini chapter does not say anything
about
overriding original access type setting.
Regards,
DT <pwadas@jewish.org.pl
