Using PHP screw for source code encryption
Url
http://sourceforge.net/projects/php-screw/
My installation Environment
System: Slackware 10
Software: Apache 1.3.31
PHP 4.3.7
The above environment is all Slackware 10 by default after the installation comes with. Specific Apache+php+mysql installation methods refer to the following
PHP-enabled Apache environment installation
Get software
Download php_screw-1.3 (http://prdownloads.sourceforge.net/php-screw/php_screw-1.3.tgz?download)
Installation
1. Place the obtained php_screw-1.3.tgz file in the/usr/local directory and unzip it with tar
Tar zxvf php_screw-1.3.tgz
2. Enter the/usr/local/php_screw-1.3 directory to start the installation
1cd/usr/local/php_screw-1.3
2phpize
3./configure
3. Set the password you use to encrypt
VI my_screw.h
--The Encryption SEED key (Pm9screw_mycryptkey) into the
Values according to.
The encryption would be a harder to break and if you add more values to the
Encryption SEED Array. However, the size of the SEED is unrelated to
The time of the decrypt processing.
* If You can read and understand the source code, to modify an original
Encryption logic would be possible. It is should not
be necessary.
optional:encrypted scripts get a stamp added to the beginning of the
File. If you like, stamp defined by
Pm9screw and Pm9screw_len in Php_screw.h. Pm9screw_len must
be less than or equal to the size of pm9screw.
4. Compiling
Make
5. Copy the php_screw.so file under the modules directory to the/usr/lib/php/extension directory
CP modules/php_screw.so/usr/lib/php/extension/
6. Edit the php.ini file
In the php.ini file, add the following statement
Extension=php_screw.so
7. Restart Apache
/ETC/RC.D/RC.HTTPD restart
8. Compile the Encryption tool
CD Tools
Make
9. Copy the tool screw in the tools directory to the appropriate directory
CP screw/usr/bin/
After the above 10 steps, the php_screw-1.3 has been installed all completed. And now PHP has supported the interpretation of encrypted PHP files.
Use
1. Now write a PHP file to encrypt.
I wrote the following compute.php file for testing php speed
01 02$a=0;
03$t=time ();
04for ($i =0; $i <5000000; $i + +)
05{$a = $a * $i;}
06$t1=time ();
07echo "
";
08echo "It used:";
09echo $t 1-$t;
10echo "seconds";
11?>
Place the above compute.php file in the/var/www/htdocs directory. Browser access will show the speed of PHP in a large number of calculations (only a rough estimate)
2. Encrypt the PHP file we wrote
cd/var/www/htdocs/
Screw compute.php
After we encrypt, now the directory of the compute.php file is we have encrypted. And the source file was renamed Compute.php.screw stored.
Now let's test the compute.php to see if we can use it properly. How fast?
I compared a bit, the speed before and after the encryption is probably the same, basically not too much loss.