Before you begin, there are two things to clarify: first, support for open source is not equal to anti-code encryption; second, if you take something that doesn't belong to you (like a company) to open source, it's even more inappropriate.
Previously know, PHP code encryption is used Zend Encoder, this thing is not only commercial software, it seems to have been able to crack the problem, so found an alternative to the scheme ────php_screw, a Japanese development of east.
The php_screw is very small and does not look at its algorithm carefully, but from the documentation, you can change the seed yourself and compile the so and executable files yourself. If you have enough cows, you can even change the algorithm yourself. Anyway, for us these "ordinary", this kind of encryption should be enough, if really want to be watertight, it is still not public good, although the author said is not very easy to crack, but there is no place where the herd it?
Installed environment requires: Php5.x,zlib on, Autoconf,automake installed.
Test environment: Ubuntu 8.04 Hardy, PHP 5.2.3.
1, decompression, change my_screw.h, the inside of a few numbers is seed, equivalent to the password, can be arbitrarily changed, increased, and the number of how much does not affect the speed of decryption.
2. Compiling so files:
$ phpize
$./configure
$ make
If such an error occurs, it is because autoconf is not installed:
$ make
Make: * * * No targets specified and no makefile found. Stop.
3, install so file, compile the file in the modules directory, copy it to the location of PHP extension storage, such as/usr/lib/php5/20060613+lfs, and then add in the php.ini:
Extension = php_screw.so
4. Compile the executable file used to encrypt the file:
$ CD Tools
$ make
The newly generated screw in the tools directory is the one that can be called in $path, such as to encrypt a file:
$ screw a.php
Success crypting (a.php)
The encrypted a.php executes normally, and screw also renames the previously unencrypted file as a backup. screw file.
Find./-name "*.php"-print|xargs-n1 screw//Encrypt all. php files
Find./-name "*.screw"-print|xargs-n1 RM//Delete all backup files for. PHP Source files
Update @ 2008-09-01
After the encryption, there is a small problem, with require or include reference to the include_path under the encryption code, as clear text, there are two ways to solve:
Use absolute path to refer to the encrypted content placed under Include_path, if it is your own host, certainly no problem;
Using relative paths to refer to, for example, in subdirectories of this project, is no problem.
[Go] Encrypt PHP code with Php_screw