0

I'm trying to retrieve PHP bytecode (and saving it to a file for further analysis) but I'm not sure exactly how to do it... I'm torn between two options:

1) Extending the Zend framework. A good article I found about this was this one: https://nikic.github.io/2012/07/27/How-to-add-new-syntactic-features-to-PHP.html. Using this technique, I would directly rewrite zend_execute() to add the functionality I want. That seems little bit complicated for me, but doable.

2) Using an extension. This seems simpler, at least based on that demo: https://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/. That being said, I can't find any resources about how to hook other functions (like zend_execute()), so I'm not sure how/if I can do what I want.

Is there resources you would suggest that I could read? Suggestions about which of these techniques is the easiest/best? Any other techniques I could use?

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
MyUsername112358
  • 1,320
  • 14
  • 39
  • you can go with zend extensions http://www.phpinternalsbook.com/php7/extensions_design/zend_extensions.html – hassan Oct 15 '17 at 08:15
  • You could always write a DLL and load it into the PHP process, and hook `zend_execute()` that way. But I think that the simplest way would be to get a debugger that supports scripting & conditional breakpoints and have a logging breakpoint on `zend_execute()`. – Martin Oct 30 '17 at 02:07

0 Answers0