Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I encrypt PHP source or compile it so others can't see it? and how?

I need to encrypt some PHP source that I've released to the public.

Is this possible? Can PHP be "compiled" ?

like image 911
footose Avatar asked Jan 22 '09 19:01

footose


People also ask

Is it possible to encrypt PHP code?

In PHP, Encryption and Decryption of a string is possible using one of the Cryptography Extensions called OpenSSL function for encrypt and decrypt.

Can PHP code be compiled?

The short answer is "no". The current implementation of PHP is that of an interpreted language.


2 Answers

You can buy Zend Guard to encode your PHP sources, and then use the Zend Optimizer to run it. There is an opensource/free PHP compiler project as well (bcompiler, and also take a look to this) but I never used it because at the time I needed it the project was still incomplete.

like image 84
tunnuz Avatar answered Sep 28 '22 14:09

tunnuz


You can have a look at phc which can generate executables from PHP. It also has some other options to create C-code, XML, optimized PHP, etc. from the original PHP source.

like image 44
Kosi2801 Avatar answered Sep 28 '22 16:09

Kosi2801