Recommend this page to a friend! | Stumble It! | Bookmark in del.icio.us |
All requests | > | Encrypt PHP file and run encrypted file on the browser | > | Request new recommendation | > | Featured requests | > | No recommendations | ||
by karthikeyan - 1 year ago (2014-12-15) php encrypt code
+3 | How can I encrypt a PHP script file and run the encrypted code on browser without decrypting it first? |
+1 | by Manuel Lemos 11100 - 1 year ago (2014-12-16) Comment There are several classes to obfuscate PHP code, if that is what you mean. Anyway, this class here actually does what you ask, encrypt PHP source code and decrypt it with a given password key. However, I would not advise using it for performance sensitive applications because decryting code every time you execute takes a good time. Maybe you want to PHP opcode encoder program. Those are usually commercial but they hide their encoding algorithms. They are not impossible to break but they give a reasonable difficulty to people that want to sneak and steal original source code. A simple alternative that does not cause performance problems is to create PHP phar archives from your code. You need to have the PHP PHAR extension to use them though. |
1. by Gerry Danen - 1 year ago (2014-12-16) Reply
I guess the question is what is the reason to encrypt. Unless you release the source code (encrypted or not), is there a need to worry? Take inspire.gerrydanen.com for example. You can get the JS easy enough, but the PHP?
2. by Manuel Lemos - 1 year ago (2014-12-23) in reply to comment 1 by Gerry Danen Reply
Yes, sometimes developers just want to obfuscate the enough to prevent that nosy customers change the scripts easily.
In that case the right action is not encryption but obfuscation or maybe binary encoding like what is done with PHAR archives.
Encryption is often an heavy task. If you need to decrypt a script every time you need to run it, it will slow down your script execution.
Furthermore encryption done in PHP code requires that the decryption code has the encryption key, so it is not much of a protection because the whoever wants to recover the original code can do it easily.
Recommend package | |
|