Hi Ondřej,
Am 25.11.2010 10:33, schrieb Ondřej Surý:
since people keep asking for that I'll ask here.

Is there a generic way how to modify configuration of some other
module from within f.e. mod-vhost-* modules? Somethink like per_dir
configuration?

I know it can be done, but you'll have to know the data structures and
link with header files of that module.

Use case:

1. Apache server using mod_vhost_ldap
2. Apache server using mod_php5
3. You want to be able to turn php_engine On/Off from the LDAP

mod_vhost_ldap would read the configuration from LDAP and inject
php_engine flag somewhere to vhost configuration in a generic way so
when mod_php5 is run it has the correct value of php_engine (the one
from LDAP).

Ondrej
I did just check my source dir of your module, and found there a 4+ years old patch hanging around which I found somewhere but never tried ...
maybe that can point you into the right direction ...

Gün.


mod_vhost_ldap.c
36a37,55
> /*
> * php4 support
> */
>
> #define PHP_INI_USER (1<<0)
> #define PHP_INI_PERDIR (1<<1)
> #define PHP_INI_SYSTEM (1<<2)
>
> #define PHP_INI_STAGE_STARTUP (1<<0)
> #define PHP_INI_STAGE_SHUTDOWN (1<<1)
> #define PHP_INI_STAGE_ACTIVATE (1<<2)
> #define PHP_INI_STAGE_DEACTIVATE (1<<3)
> #define PHP_INI_STAGE_RUNTIME (1<<4)
>
> __BEGIN_DECLS
> int zend_alter_ini_entry(const char *, size_t, const char *, size_t, int, 
> int);
> int zend_restore_ini_entry(const char *, size_t, int);
> __END_DECLS
>
90a110
> char *open_basedir; /* PHP4 open_basedir Support */
94c114
< { "apacheServerName", "apacheDocumentRoot", "apacheScriptAlias", 
"apacheSuexecUid", "apacheSuexecGid", "apacheServerAdmin", 0 };
---
> { "apacheServerName", "apacheDocumentRoot", "apacheScriptAlias", 
> "apacheSuexecUid", "apacheSuexecGid", "apacheServerAdmin", 
> "apachePhpOpenBaseDir", 0 };
503a524,526
> else if (strcasecmp (attributes[i], "apachePhpOpenBaseDir") == 0) {
> reqc->open_basedir = apr_pstrdup(r->pool, vals[i]);
> }
515,516c538,540
< "apacheSuexecGid: %s",
< reqc->name, reqc->admin, reqc->docroot, reqc->cgiroot, reqc->uid, reqc->gid);
---
> "apacheSuexecGid: %s, "
> "apachePhpOpenBaseDir: %s",
> reqc->name, reqc->admin, reqc->docroot, reqc->cgiroot, reqc->uid, reqc->gid, 
> reqc->open_basedir);
552a577,581
> // php open_basedir
> if (reqc->open_basedir) {
> zend_alter_ini_entry("open_basedir", sizeof("open_basedir"), 
> reqc->open_basedir, strlen(reqc->open_basedir), PHP_INI_SYSTEM, 
> PHP_INI_STAGE_RUNTIME);
> }
>

mod_vhost_ldap.schema
63a64,71
> attributetype ( 1.3.6.1.4.1.8387.1.1.9 NAME 'apachePhpOpenBaseDir'
> SUP name
> DESC 'mod_vhost_ldap: PHP open_basedir'
> EQUALITY caseIgnoreMatch
> SUBSTR caseIgnoreSubstringsMatch
> SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256}
> SINGLE-VALUE )
>
68c76
< apacheSuexecUid $ apacheSuexecGid ) )
---
> apacheSuexecUid $ apacheSuexecGid $ apachePhpOpenBaseDir ) )

Reply via email to