Page 1 of 1

PHP Engine hooks

Posted: Mon Dec 10, 2007 3:43 am
by alex.barylski
This can probably be done using an extension, but I would like to avoid that if possible. Ideally if there is a way to invoke a command before parsing of every script file (includes and all) that would be best.

Basically I have a filter program which I wish to run over the source code and have that feed the results to the PHP engine for parsing, execution, etc...

Other than using an extension, is there a way I can configure PHP to pass the source to a binary and use the results of that operation?

Any ideas?

Posted: Mon Dec 10, 2007 4:28 am
by Jenk
I fail to see why you would want to do this.. and as far I know, there isn't a way to do it.

Posted: Mon Dec 10, 2007 5:13 am
by alex.barylski
Jenk wrote:I fail to see why you would want to do this.. and as far I know, there isn't a way to do it.
I have my reasons. :)

I've looked into it and it doesn't appear possible - at least using the technique I've described.

Posted: Mon Dec 10, 2007 6:19 pm
by feyd
There is nothing automagically available. You would either have to run through your own version of include/require or extend PHP.

You'll also need an auto_prepend.

Posted: Mon Dec 10, 2007 6:35 pm
by Weirdan
There was a thread about something similar (rewriting code on the fly)... oh, here it is: viewtopic.php?p=415646

Posted: Mon Dec 10, 2007 7:12 pm
by alex.barylski
Thats looking pretty promising...Thanks for that :)