I know this is ugly, but what about making the extensions handle it themselves?
Your example of session_pgsql:
In the extension init code:
ext_enabled = 1;
if ( dlsym( NULL, "psql_module_entry" ) == NULL &&
dlsym( NULL, "_psql_module_entry" ) == NULL )
{
// print some warning about needing the pgsql extension
// or pgsql should be loaded before this one in the php.ini
ext_enabled = 0;
}
if ( dlsym( NULL, "session_module_entry" ) == NULL &&
dlsym( NULL, "_session_module_entry" ) == NULL )
{
// print some warning about needing the session extension
// or session should be loaded before this one in the php.ini
ext_enabled = 0;
}
The second call with a underscore is to handle Openbsd and old
version of FreeBSD, I think a.out things. I am sure this can be
handled differently, but you get the point.
Cheers,
Brian
At 9:19 AM +0900 9/2/02, Yasuo Ohgaki wrote:
>We know current module loader is not smart :)
>
>As number of modules increases, number of module depends on another
>increases. Examples are mbstirng/mailparse/exif,
>session/msession/session_pgsql and bunch of session save handler
>modules out there, session_pgsql depends of session and pgsql module,
>etc.
>
>(Loading sessoin save handler as module does not work at all, since
>current module loader isn't take into module dependency at all)
>
>I would like to see smart module loader and/or ini parser that can
>address this issue. PHP crashes easily w/o it.
>
>IF statemnet is better than now, but it's not good enough.
>I don't think this carefully, but here is my idea.
>
>Add following member so that get_module() retrive
> loading weight (we need this so that we can control sub module
> loading order)
> list modules depend on
>Check if module required is there, raise E_WARNING
> if module cannot be loaded.
>Sort modules so that modules are loaded w/o problem.
>Load modules.
>
>This is easy to implement, isn't it?
>We may better to have smart ini parser, but it may not be
>required strictly for this purpose.
>
>I don't have plan to write this, since I need to modify
>engine code. I hope Andi or Zeev like this idea for PHP5 :)
>
>BTW, I'm +1 for having IF statement in php.ini.
>
>--
>Yasuo Ohgaki
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php