We help IT Professionals succeed at work.

encrypt my php code

savsoft asked
I want to encrypt my php code..

I want that if i give my script to any other pperson then he/she will not be able to read code . but can only see encrypted code

There are lot of softwares available in market but i want to know about technique which they use

Watch Question

Dave BaldwinFixer of Problems
Most Valuable Expert 2014

The two common programs for encoding PHP also include the decoder which must be installed on the server.  The code must be decoded each time it is run because the PHP interpreter won't understand it otherwise.  There is also things like Phalanger http://phalanger.codeplex.com/ that compiles your PHP into .NET runtime.  And there are programs that 'obfuscate' the PHP code by removing all comments and renaming all the variables to machine generated names like $a1 that won't mean anything to a person and will make it difficult to reverse engineer the code.
Sr. Architect
It is not possible to encrypt the php code, but you can encode it using lot many tools.
Every tool comes with encoder and decoder, where you apply encoder manually on your code to make it non-readable.
At the same time it become non-readable to your php interpreter as well and hence your pages won't be rendered correctly in browser.
In order to make them working properly on browser, you server need to know how to decode these pages just before sending it to php interpreter so that for php interpreter its always readable php code.

1. This process will reduce the performance, but level of performance downgrade depends upon what kind of encoding is applied. As response to every request will require decoding of your page before interpretation by php.
2. Every encoder comes with decoders as well, so it is not tough job to decode the code if you share the encoded one with somebody.
3. Java script on browser will remain as it is and code in browser will always remains same, php encoder will only provide you the protection from somebody having access to webserver.
4. If you want to protect java script, you will need to use good Java Script encoder, instead of php encoder.

Entire decision depends on your need.

-Rahul Gade


Sir pleae provide me any siimple method that i want to encode my file but i want ke there should be key that should also require to decrypt the code

Simple and best possible way