Tom,

Thanks for the reply.  As it happens, I went ahead and hacked around in
the internal a bit more, and came up with a working solution bypassing
zend_alter_ini_entry, instead getting the php per-server config block, and
updating the configuration has via zend_hash_update calls.

It works (though there is a case where corruption of the php config block
can occur, so care is warranted), but leaves me still wondering if there
is any "official" way to do this, or at least one recommended over
another.  In other words, is _alter_ini_ a better tactic than
_hash_update?

Any opinion?

On Mon, September 26, 2005 20:42, Tom Rogers said:
> Hi Todd,
>
> A small typo in one line corrected
>
> ***************************************
>
> I have done a similar thing for apache 1.3 and did the following:
>
> added headers
>
> #ifdef HAVE_MOD_PHP_SUPPORT
> #include <zend.h>
> #include <zend_qsort.h>
> #include <zend_API.h>
> #include <zend_ini.h>
> #include <zend_alloc.h>
> #include <zend_operators.h>
> #endif
>
> and the following code
> (doc_root is set to /usr/local/apache/domains/domain.com)
>
> // It all comes down to this lot
> //all virt domains get an include directory above document root
> var = ap_pstrcat(r->pool, doc_root, "/include", NULL);
> //build a new include path adding in the default
> include_path =
> ap_pstrcat(r->pool,"./;",var,";",zend_ini_string("include_path",13,1),NULL);
> //update zend
> zend_alter_ini_entry("include_path", 13, include_path,
> strlen(include_path), 4, 16);
>
> //set some env vars
> ap_table_setn(r->subprocess_env, "PHPINCDIR", var);
> ap_table_setn(r->subprocess_env, "DOMAIN_ROOT", doc_root);
> //correct the documennt root (all html is in doc_root/www)
> conf->ap_document_root = ap_pstrcat(r->pool, doc_root, "/www",NULL);
> //add openbase dir to the one set in httpd.conf
> obasedir_path = ap_pstrcat(r->pool, aliases->OpenBaseDir, ";", doc_root,
> NULL);
> //update zend
> zend_alter_ini_entry("open_basedir", 13, obasedir_path,
> strlen(obasedir_path), 4, 16);
>
> You will have to use different ap_xxx commands but it should work
> --
> regards,
> Tom
>
>


Todd D. Esposito
www.ToddEsposito.com
[EMAIL PROTECTED]
630-362-6868

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to