PHP Source code Encryption

Source: Internet
Author: User

Encryption Software (PHP_SCREW)

"Download website:http://sourceforge.net/projects/php-screw/

Description:php files are usually stored in text format on the server side, it is easy for others to read the source code, in order to

Source code can be used to encrypt the source code. Two parts are required to implement this function

One is: Encryption program, to achieve the encryption of PHP files

The other is: parse the encrypted PHP file to get the result. The realization of the former is relatively simple

Single, is just a procedure. Most of the latter implementations are implemented in the form of PHP module.

"Php_screw (screw) can achieve the above functions. The latest version is 1.5 and can be downloaded from sourceforge.

"Php_screw is a Japanese-developed PHP encryption program, but only runs under Linux

Installation

Description: The purpose of the installation is actually to produce two files, one is used to encrypt PHP files screw, another

PHP-loaded parsing module php_screw.so

Installation Environment

System: CentOS 5.3

Software: Apache 2.2.9

PHP 5.2.10

The above environment is all installed by their own download configuration. For specific Apache+php+mysql installation methods, please search online.

Installation

1. Unzip the TAR-ZXVF php_screw-1.5.tar.gz with tar

2. Enter the php_screw-1.5 directory to start the installation

CD php_screw-1.5

Phpize

As for the phpize, it is just the Php5-dev module installed in the Php5-dev expansion module.

./confiugre

3. Set the password you use to encrypt

Copy the code code as follows:

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/php5/extension directory

CP modules/php_screw.so/usr/lib/php5/extension/

6. Edit the php.ini file

In the php.ini file, add the following statement

Extension=php_screw.so

7. Restart Apache

/srv/apache/bin/apachectl 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.5 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 test.php file for testing php speed

Copy the code code as follows:

<?

$a = 0;

$t =time ();

for ($i =0; $i <5000000; $i + +)

{$a = $a * $i;}

$t 1=time ();

echo "<p>";

echo "It used:";

echo $t 1-$t;

echo "seconds";

?>

Place the above test.php file in the/var/www/directory. Browser access will show the speed of PHP in a large number of calculations (rough estimate)

2. Encrypt the php file we wrote

cd/var/www/

Screw test.php

After we encrypt, now the directory of the test.php file is we have encrypted. And the source file was renamed Test.php.screw stored.

Now let's test the test.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.

3. Batch encrypted files

In Debian, Apache2, PHP5, after testing the. html file encryption, the correct parsing can be done;

Php_screw How to encrypt the file under the current directory, the files contained in the directory, and the files contained in the directory

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

This will encrypt all the. php files in the current directory.

PHP Source code Encryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.