63

Is it possible to hide/encode/encrypt the php file/source code, and let others have the system installed and run on their machine?

Sherif
  • 11,786
  • 3
  • 32
  • 57
Newbie
  • 2,775
  • 6
  • 33
  • 40
  • 1
    I heard of ZendGuard, but its not 100% safe. http://www.zend.com/en/products/guard/ – kingdaemon Aug 13 '13 at 07:32
  • 13
    Nothing is bulletproof. So answer is NO. – Glavić Aug 13 '13 at 07:32
  • 2
    I think this way is not correct, you can create formal contract to prevent re-using your software... –  Aug 13 '13 at 07:32
  • 1
    The buyer only wants to buy the system only. Anyway, I know there is some legal ways to do it. But I am just wondering if there is some technical way to do it. – Newbie Aug 13 '13 at 07:36
  • 4
    this is why i write SaaS it runs on my servers. –  Aug 13 '13 at 07:40
  • May be we have focus too much on why I am doing it. OK, shall we just take it as a technical problem and discuss its possibility? thx – Newbie Aug 13 '13 at 07:40

6 Answers6

65

Yes, you can definitely hide/encode/encrypt the php source code and 'others' can install it on their machine. You could use the below tools to achieve the same.

But these 'others' can also decode/decrypt the source code using other tools and services found online. So you cannot 100% protect your code, what you can do is, make it tougher for someone to reverse engineer your code.

Most of these tools above support Encoding and Obfuscating.

  • Encoding will hide your code by encrypting it.
  • Obfuscating will make your code difficult to understand.

You can choose to use both (Encoding and Obfuscating) or either one, depending on your needs.

Arshid KV
  • 9,631
  • 3
  • 35
  • 36
Rohit Chemburkar
  • 1,019
  • 8
  • 13
15

There are many ways for doing that (you might want to obfuscate the source code, you can compress it, ...). Some of these methods need additional code to transform your program in an executable form (compression, for example).

But the thing all methods cannot do, is keeping the source code secret. The other party gets your binary code, which can always be transformed (reverse-engineered) into a human-readable form again, because the binary code contains all functionality information that is provided in your source code.

Abrixas2
  • 3,207
  • 1
  • 20
  • 22
  • 3
    This is the only answer which is objective, correct, and not misleading. – MickLH Feb 08 '15 at 16:33
  • Good answer, but to qualify that... reverse engineering binary code is possible, but not easy. You need to be willing to spend substantial time and resources on it, and therein lies most of the deterrent. – Need A Hand Feb 09 '15 at 07:44
  • It is running on the server, the client sees just the output of the server-side php script. So why the need to encrypt or protect the php file? Do we need to protect NodeJS JavaScript files also that run at the backend? – Emre Tapcı Apr 24 '21 at 21:00
7

There are commercial products such as ionCube (which I use), source guardian, and Zen Guard.

There are also postings on the net which claim they can reverse engineer the encoded programs. How reliable they are is questionable, since I have never used them.

Note that most of these solutions require an encoder to be installed on their servers. So you may want to make sure your client is comfortable with that.

Sutandiono
  • 1,748
  • 1
  • 12
  • 21
3

You could just split the frontend and backend. The frontend is hosted on the customers server with an API that makes calls to the backend on your server. This keeps all of the proprietary code proprietary and forces users to sign up / pay for subscriptions.

John Proestakes
  • 317
  • 2
  • 5
  • 1
    OP said `let others have the system installed and run on their machine` so hosting the backend on your server is not an option – ibex May 31 '18 at 21:57
-3

There are some online services for obfuscate php to hide the code from others. This is one Right Coder's Free Obfuscator Online

@Glavić is right. "Nothing is bulletproof". You can encode your source code and hide from bigger programmers, not from experts.

Rana Hyder
  • 75
  • 1
  • 1
  • 8
-19

https://toolki.com/en/php-decoder/

Decode hidden PHP eval(), gzinflate(), str_rot13(), str_replace() and base64_decode()

Vel
  • 9,027
  • 6
  • 34
  • 66
Akhila Prakash
  • 481
  • 4
  • 17