tags:

views:

130

answers:

3

Hello,

How do I obfuscation the PHP code.

Thanks Jean

+3  A: 

PHP code does not need to be compiled, you can simply drop it into webserver or run with php excutable. IF you want to protect your code from others copying it - you can try PHP source encryption - Source Guardian, PHP Cipher or some other. Usually encrypt software is commercial, but clients can have decrypt for free...

Laimoncijus
Though it should be noted that obfuscation will never truly protect your code.
Will Vousden
I need to protect the code, given the to the client
Jean
@Will Vousden, yes, kind of. The great secrets of how-it-does-stuff will not be made secret. But most code is worth money because of how well it is organized, how maintainable it is, and how well it does what it does. The last one is not protectable, the but other two are. So obfuscating code does protect it 100% from a client who wants to get rid of you. Whether that's a good idea is another story altogether.
Yar
+2  A: 

PHP code is an interpreted language, not a compiled one. This means that no matter what you do to the source code, in order for it to run, it CAN be gotten to by whoever has it. You can obfuscate the source, but there is no way to do this would would 100% prevent someone who has the code from de-obfuscating it, although it would be much less readable then the original source.

The short answer to "How do I compile PHP code so my client can't modify it" is "you don't."

Erik
A: 

Just wanted to chime in: you are referring to "obfuscation" not "compilation" since PHP is interpreted. This was said by the other answers.

It is a bad idea, generally, to not want to release your source code. This is because instead of forcing your client to rely on you because only you have the source, you should try to get the client to rely on you because you're the smart person who wrote the source in the first place.

That said, that's business stuff, and so it it not programming related.

Does obfuscation protect your source code? Yes, of course. Your source code is worth something because it does what it's supposed to well. If they deobfuscate, they will also have source that does what it's supposed to well. However, code is also worth money because it is well-organized, well-written and therefore maintainable. Deobfuscated code is never good code, though it does work. It will never be well-written (from a human standpoint) nor maintainable (by humans).

So if you've chosen to not release your source to a client, obfuscation is great way to do this.

Yar