How to encrypt a PHP file for free? [closed]
Asked Answered
B

5

10

I have created a plugin for WordPress although I would like to encrypt it to stop people from viewing the source code. I've heard of Zend Guard and IonCube although is there a free alternative to these?

Bod answered 24/7, 2011 at 20:55 Comment(0)
S
8

Looks like the things you choose are not working this way:

  • Wordpress is open source
  • PHP is not compiled
  • any obfuscation can be decoded

If you don't want to share the source, provide the code as a service. You may require the user to enter API key etc.


  • Execute the code on your server and send response (e.g. JSON or XML) to the Wordpress part.
  • Allow only the users who paid for the service to access the service on your server
  • Authenticate the users by selling and then checking the API key

See: SaaS

Shoreless answered 24/7, 2011 at 21:23 Comment(1)
Ooh, what do you mean by API key? It would be great if they are required to enter a key to use it, which is the reason for encrypting the code anyway.Bod
U
4

Try this one: PHP Encoder

This might be the answer you are looking for.

Unquestionable answered 8/10, 2012 at 15:9 Comment(3)
One way is creating a function that may require a key to complete an encryption or decryption. PHP has its built-in functions like gzdeflate() or gzinflate(), another is using base64_encode()/base64_decode() and str_rot13() or hash() and md5() functions.Unquestionable
Isn't md5 a non reversable function? How could you obfuscate code with it? $x = 'something'; $h = md5($x); if you know only $h how would you revert back to $x?Margalit
@Unquestionable The website is no longer available.Leeannaleeanne
A
2

What your are looking for is an obfuscator for php. This post may be a duplicate to: Is there a code obfuscator for PHP?

However some words. Contributions to the opensource world like contributing a wordpress plugin may help you more while people are able to read your code.

Acidulant answered 24/7, 2011 at 21:2 Comment(1)
No. Source encrypting is not obfuscating - it is much better thing. All function, class and variable names don't change, but source code is unavailable.Polypetalous
I
2

I don't know your plugin code in specific (and obviously you don't want to make me know it), but keep in mind if you re-use parts of the wordpress codebase in your plugin, your must distribute your code under a compatible license. That means compatible to GPL v2 for the current version.

However this GPL license requires you to provide source code, which specifically means non-obfuscated and non-encrypted. Source-code is the form of a software you use to make modifications to it.

So in your case, encrypting your plugin's code and distributing it could result in a termination of usage rights on the wordpress code for you. This includes the right to create derivates (your plugin) and distribute such derivates (sending your plugin to someone else). Naturally those who will get that plugin do not have any license as well to make use of your derivate.

That's not really an ideal situation if you ask me, especially as once termination of rights is in effect, you must get into contact with every single copyright holder of the wordpress package and ask for re-instatement of rights, something you will be hardly able to.

So take care if you re-use existing code or create derivates that you meet the licensing requirements. Especially if it's about your rights.

IANAL and I can only suggest that next to the technical part like obfuscation/encryption there is also the part of software licensing that can play a role. You just should contact a lawyer and clarify that software licensing situation not that your customers one day demand stuff from you, you never thought about you must deal with. In the end you will have a contract with your customers, so better take care.

Interpellate answered 24/7, 2011 at 21:54 Comment(0)
P
1

Since PHP is not compiled. Ioncube and Zend Guard are your only options. Your users will also need to install the loaders for those addons in order to use your code. Which may not be possible in many hosting situations.

Since those plugins are designed to encrypt complete applications, they or may not work with plugins.

Pray answered 24/7, 2011 at 21:3 Comment(1)
You can use phpBolt PHP extension. You can download from phpBolt.comVasilikivasilis

© 2022 - 2024 — McMap. All rights reserved.