In the process of using PHP, I found that because the PHP code I wrote was placed on the server in the form of source code, it could easily be taken away and modified by others (to be developed by myself) and used.
In order to protect the fruits of my labor, I have been looking for a software that can encrypt PHP code.
The most famous one is Zend’s Zendencoder, but it is not an open source software (the price is very high and no cracked version has been found).
Since we can’t afford the paid ones, we will use open source ones. I found the open source software php_screw. The latest version is 1.5
Installation environment
System: centos 5.3
Software: Apache 2.2.9
PHP 5.2.10
All the above environments are downloaded, configured and installed by yourself. Please search the Internet for specific Apache+php+mysql installation methods.
Installation
1. Use tar to decompress tar -zxvf php_screw-1.5.tar.gz
2. Enter the php_screw-1.5 directory to start the installation
cd php_screw-1.5
phpize
About phpize, it only needs to install the php5-dev module in the php5-dev extension module.
./confiugre
3. Set your own password for encryption
";
echo "It used:";
echo $t1-$t;
echo "seconds";
?>
Put the above test.php file in the /var/www/ directory. Accessing through the browser will show the speed of PHP in large-scale calculations (rough estimate)
2. Encrypt the PHP file we wrote
cd /var/www/
screw test.php
After we encrypt it, the test.php file in the directory is now encrypted. The source file was renamed test.php.screw and stored.
Let’s test test.php now to see if it can be used normally? How is the speed?
I compared it and found that the speed before and after encryption is about the same, and there is basically not much loss.
3. Batch encrypted files
After testing on debian, apache2, php5 to encrypt the .html file, it can be parsed correctly;
How does php_screw work on the directory in the current directory? Files included under the directory and files in the included directory are encrypted as a whole
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 will be encrypted