Parse How to Use php screw to encrypt php source code

Source: Internet
Author: User

In the process of using PHP, it is found that the php Code Compiled by myself is put on the server in the source code mode, so it is easy for others to take away and modify the code (which is developed by themselves.
To save my work, I have been searching for software that encrypts php code.
Zendencoder of Zend is the most famous, but it is not an open-source software (the price is very high and no cracked version is found ).
Since the cost is not enough, we will use open source. I found the php_screw open-source software. The latest version is 1.5.
Installation environment
System: centos 5.3
Software: Apache 2.2.9
PHP 5.2.10
All of the above environments are downloaded, configured, and installed by yourself. For more information about how to install Apache + php + mysql, visit the internet.
Install
1. Decompress tar-zxvf php_screw-1.5.tar.gz with tar
2. Go to the php_screw-1.5 directory to start Installation
Cd php_screw-1.5
Phpize
About phpize, it is enough to install the php5-dev module in the php5-dev extension module.
./Confiugre
3. Set your own password for encryption
Copy codeThe Code is as follows:
Vi my_screw.h
-- Please change the encryption SEED key (pm9screw_mycryptkey) into
Values according to what you like.
The encryption will be harder to break, if you add more values to
Encryption SEED array. However, the size of the SEED is unrelated
The time of the decrypt processing.
* If you can read and understand the source code, to modify an original
Encryption logic will be possible. But in general, this shocould not
Be necessary.
OPTIONAL: Encrypted scripts get a stamp added to the beginning of
File. If you like, you may change this stamp defined
PM9SCREW and PM9SCREW_LEN in php_scre1_h. PM9SCREW_LEN must
Be less than or equal to the size of PM9SCREW.

4. Compile
Make
5. Copy the php_scresponso file under the modules directory to the/usr/lib/php5/extension directory.
Cp modules/php_scresponso/usr/lib/php5/extension/
6. Edit the php. ini file.
Add the following statement to the php. ini file:
Extension = php_scresponso
7. Restart Apache
/Srv/apache/bin/apachectl restart
8. Compile the encryption tool
Cd tools
Make
9. Copy the tool screw used for encryption under the tools directory to the appropriate directory.
Cp screw/usr/bin/
After the above 10 steps, the php_screw-1.5 has been fully installed. Now, php supports interpreting encrypted php files.
Use
1. Write a PHP file to be encrypted.
I wrote the following test. php file to test the php speed.
Copy codeThe Code is as follows:
<?
$ A = 0;
$ T = time ();
For ($ I = 0; I I <5000000; $ I ++)
{$ A = $ a * $ I ;}
$ T1 = time ();
Echo "<p> ";
Echo "It used :";
Echo $ t1-$ t;
Echo "seconds ";
?>

Put the above test. php file in the/var/www/directory. Access through a browser will show the speed of php in a large amount of computing (rough estimation)
2. encrypt the PHP file we wrote.
Cd/var/www/
Screw test. php
After encryption, the test. php file in the directory is encrypted. The source file is changed to test. php. screw and stored.
Now let's test. php to see if it can be used normally? Speed?
I have compared it. The speed before and after encryption is roughly the same, and there is basically not much loss.
3. Batch Processing of encrypted files
Correct parsing can be performed after the .html file is encrypted On debian, apache2, and PHP 5;
How does php_screw encrypt the files in the current directory and the files in the directory?
Find./-name "*. php"-print | xargs-n1 screw // encrypt all. php files
Find./-name "*. screw"-print/xargs-n1 rm // Delete the backup files of all. php source files
In this way, all. php files in the current directory are encrypted.

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.