Can someone tell me if the php blenc extension encrypts PHP bytecode or a PHP string.

Currently I'm stuck back on PHP 5.3 because I need support for bcompiler. There is a PHP extension called blenc which encrypts a .php file into a .phpenc file. I'm wondering if this .phpenc file is encrypted bytecode or encrypted PHP code.

I'm asking here because this community has tremendous experience with the PHP runtime.



7.2k

You forget that you are in forum Phalcon :) If you want to protect your code, or speed it up, try using Zephir https://github.com/phalcon/zephir

This method is faster and more reliable.



44.6k

Yes I'm aware of that and have been for some time. I think however that it is only half of the solution. Sure it can be quicker but not all code is suitable to go there and also extra great care needs to be given to something that will be globally run and so not as easily updatable in the long term.

Great so zephir looks great but as I've said numerous times here and the old Google forums, what is really needed is for the phalcon team to add in some tiny functions in the spirit from the blenc or bcompiler extensions so that phalcon has its on code optimizer and bytecode obfuscator. Phalcon could do some interesting things in this regard by allowing the MVC comment annotations to be usable with a bytecode source protector, and currently this isn't the case, not possible. Additionally there would be opportunity for phalcon to make it easy to load all of the bytecode files into the php opcode cache so that there is never a dry run on web server reboot.

I'm pretty damn sure that the phalcon devs could whip up something simple that compiles the PHP into bytecode and then stores that file with a little header for the loader. Hell there are already two bits of code that do this in their own way but they don't work quite right with new PHP versions or are overly complicated; both blenc and bcompiler. I'm good enough at reading C to see that it is fucking childs play for a real C dev familiar with phalcon. Now I think that bcompiler is overly complicated for what phalcon needs and probably it was designed before the PHP 5.3 namespace feature so being able to combine multiple files into one is not really a very relevant feature. The phalcon devs could do this in their sleep.

In their sleep.

Well I've never heard a single person tell me that this is a good idea, let alone say that they might do it someday.



7.2k

Try ionCube solutions, may be. It works with PHP 5.4.