PHP code encryption
The last few days I’ve been experimenting with encrypting php code. I’ve written an app that I want to distribute to people for free…but I don’t want them changing it. So, I’ve looked into a lot of different programs that will encrypt your php code so you can distribute it but people can’t see the actual code. Here are some I looked at:
codelock (I think)
ioncube is one of the absolute best for performance, but it’s $199 for the encoder and the decoder is server specific and for my distribution that doesn’t work.
freelock was interesting because it didn’t require them to install a decoder, just for you to include another php file with your distribution of code. That file decrypts the code. It worked really well on my home server and on one of my hosted servers, but it wouldn’t run on another hosted server now matter what I did. I decided that wasn’t going to work
codelock I couldn’t get to work, but I’ve heard good things about it.
phtml encoder has some self decoding files which is what I wanted, but they only work between 8am and 6pm on weekdays. It costs $120 to get them to work anytime.
In the end I just went with a program that obfuscates the php code.
It just encrypts the code so that humans can’t read it. However, I’m pretty sure it’s easily decoded so that a human could read it. I haven’t looked into decoding it that much because I don’t care that much if someone undoes some of my code, but I’m pretty sure that all you’d have to do is take the file and print out a base64_decode() of what’s in the file.
All in all, I found that if your distribution is limited and you can control what kinds of servers it’s going to go on, it’s pretty easy to encrypt php code. All of them (except for codelock) worked the first time I tried them and were super easy to encrypt the code with. If you’re distributing to the masses however, I didn’t find a php encryption program (a free one mind you) that would be suitable for distribution and be reliable enough on enough servers to make it worth it.
Filed under Technology by