2

If I create an application in java I compile it and it's hard to steal the code even if I send you the application. I know you can do it with reverse engineering and such but anyways.

If I create an application in PHP and put it on a clients server the client could copy paste the code if he or she wanted.

So my question is. Is there any convenient way to compile or somehow protect your PHP code from others even if it runs on their servers?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Tiax
  • 269
  • 5
  • 14
  • 4
    Java is easy to decompile. Besides that, why would someone want to steal your PHP code? Does it contain any secrets? If not, why not give your customers the ability to customize it. – ThiefMaster Oct 10 '11 at 12:01
  • 1
    In line with @ThiefMaster's comment: The licensing model should cover the rights of the user to copy and customize the code. After all, it's not the *implementation* that's interesting. It's the *idea* / *problem it solves* / etc. – jensgram Oct 10 '11 at 12:05
  • see: [EULA](http://en.wikipedia.org/wiki/Software_license_agreement) It wont prevent them from stealing your code, but if they do, you could sue them and you'd win =) ... maybe – pleasedontbelong Oct 10 '11 at 12:12
  • @ThiefMaster: Any customizations done by my clients would nullify any warranties I gave them though. – Decent Dabbler Oct 10 '11 at 12:18

2 Answers2

5

You could use IonCube to encode your files if you can afford it.

On the other hand, you could use APC to cache the bytecode and then set APC variable apc.stat to 0 and then remove your php files from the server. That way APC will always look in the cache without verifying that actual php files have changed.

You could also use HipHop to compile your code, but it's tricky to set up and more than often it doesn't compile without errors.

N.B.
  • 13,688
  • 3
  • 45
  • 55
1

There is a PHP compiler produced by Facebook, called HipHop. See http://developers.facebook.com/blog/post/358 for more info.

However, the primary purpose of this compiler is to speed up your code, not to protect it. Compiling in itself is not a protection measure for any kind of code.

Spudley
  • 166,037
  • 39
  • 233
  • 307