I have finished my new php script, and I'm about to sell it. I want to encrypt/encode/obfuscate or any thing that will enable me to protect my code. I read every single post here about this matter, but I didn't get any clue. Is there any FREE tool I can use? Do you have other ideas on how to protect my code, so that nobody can resell it with their name?
What you want is called an obfuscator. There are many available for PHP, but they all have one thing in common: they will only stop casual observers from reading your code. A determined person with access to your files will be able to decode it and get the original (mostly) back again.
You also need to couple with the fact that once obfuscated, the person buying your code is not going to be able to debug it, fix any problems or add features of their own. If I bought a PHP script from someone and it came back obfuscated, I'd ask for my money back because obfuscated code is completely useless to me: I'd have to contact you (and you'd probably want to charge me) for every minor thing I wanted changed.
There isn't much that you can do. There should be a PHP obsfuscator out there, but the client will need something to un-obfuscate it. That said, obsfucation isn't exactly secure. Even compiled languages can be reverse engineered with the right know-how. Best bet? Get a good lawyer and keep an eye on the market.
You could check out the php compiler. It should make your code as secure as c would be, and much cheaper than a lawyer.
The simplest terms requre obfuscation - which simply makes the code harder to read, though it can still be reverse engineered. Products like RaizeLabs, POBS and CodeEclipse are free.
You may wish to actually encrypt your code with a commercial product like Turck MMCache, or Zend Guard, though be aware that these may require special PHP modules running on the server. If you use one and your clients don't have full control of their hosting servers, they may not be able to use your tool.
How about converting your PHP code to C++? That way it can be compiled to machine code.
HipHop for PHP does it for you.
http://stackoverflow.com/questions/1090124/convert-php-to-c-code