Is it possible to write a PHP extension (UNIX, CGI SAPI) where I can:
- redefine the implementation of a PHP function (like with mail(): many PHP softwares uses the standard mail() function - I can't change that since customers want to use that, end of story ... - but I need rewrite it, as in chroot()'ed environment it's not possible to spawn a sendmail process - I need socket level communication which is not standard SMTP either btw)
- "stop" PHP interpreter (so I can do other things for my oen) before doing the actual parse/execute of the PHP script, but after doing ALL of the initialization work (extension loading, ini file parsing, etc), let's call it "before php script execution hook" or so :)
- force parsing an INI file (path is generated/definied by me) which can redefine all of the setting which was set before (if it was at all)
Currently I've modified the PHP source itself, but that's ugly and maybe dangerous as well, it would be nice if I can do this as a PHP extension, well, at least with something looks like a PHP extension :) so I don't need to modify the "core PHP" ...
Thanks a lot in advance!