5

I have done a PHP web application and my client request to host it at their server. How can I protect my PHP code so that it will not be viewed, study, or take it for any other usage by my client?

  • 2
    I don't believe you can. Not without a signed license agreement. However, if they paid you to develop the code, they own it unless otherwise stated within an agreement. – closetnoc Nov 9 '14 at 3:16
  • 2
    If the work was done "for hire" they own it, otherwise you should have written up a contract you'd had them sign before even working on the project specifying ownership of the code by you and a license for them to use it, how they're permitted use it, whether they have rights to modify it and specific legal pursuit if the contract is not followed. Afterwards is too late and it's a lesson learned for the next project you take on. Various code protection schemes are out there, like Ion Cube but applying after the fact without specifying by contract leaves a certain smell on your integrity. – Fiasco Labs Nov 9 '14 at 4:32
9

You can encode your code using ionCube and similar products. Your client won't be able to view, study or take it.

However, everything can be reverse engineered meaning that, no matter how you encode your code, it can be decoded. For example, ionCube can be decoded with decry.pt. It works, I can confirm it.

So you'll never be able to really secure your code but this is a good start.

Of course, after encoding the script, make sure that the client isn't allowed to view, study or take it. Choose a proper license for your script.

Make sure you have a signed written contract between you and the client stating the conditions for license use so the license is enforceable in a court of law.

| improve this answer | |
  • Making sure the client isn't allowed to view the script involves having a proper contract in place that enforces the license and provides judicial recourse if the code is decrypted and reused. – Fiasco Labs Nov 9 '14 at 18:55
  • @FiascoLabs Yes, as I said in my answer. – William Edwards Nov 9 '14 at 19:41
  • License != Contract. Just wanted to make that clear as you only mentioned the license. Most people think they can slap a license on after the fact, shrinkwrap clauses only work for huge multinationals with highly paid lawyers. The contract must exist first and be signed. Open source licenses can be applied to released code ensuring they remain free, paid for code needs contractual protection. – Fiasco Labs Nov 9 '14 at 19:52
  • @FiascoLabs Correct, you've got a point. Feel free to edit the answer if you'd like to add that. – William Edwards Nov 9 '14 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.