How to Use php_screw to encrypt PHP program instances

Source: Internet
Author: User

Currently, there are a lot of software for encrypting php programs. The most common one is the one on the official website, but it is billed, next I will introduce a PHP program that can be encrypted using php_screw. Let's look at the example below.

PHP_Screw is a free extension of PHP to encrypt PHP source code. It can customize the encryption of seed files. The efficiency of encrypted files will not decrease, and it has not yet been cracked. The following describes how to install and use

The latest version is php_screw_1.5.

The official site can only go to the source code
Download the latest version from the official site:
Http:// Group_id = 52025

Installation steps:
1. Download the source code:

2. decompress:
tar zxvf php_screw_1.5.tar.gz

3. You can see from the README. en file that the software package of this version requires the PHP5.x environment and zlib support (by executing the script check ). If you are using PHP4.X, download php_screw_1.3.

4. Go to the source code directory.
#cd php_screw_1.5
root@Server:~/php_screw-1.5# vim php_screw.h
#define PM9SCREW “tPM9SCREWt”
#define PM9SCREW_LEN 10
#define PM9SCREW_LEN 9

5. php_screw.h file. If you do not change this file, the content of your encrypted file will start with PM9SCREW. If you copy it to google search, you will know that it is encrypted by the screw module, although no decryption algorithm is found on the internet, it will not be necessary in the future. This is done to hide the encryption algorithm, so that others do not know what algorithm you are using and what encryption algorithm you are using. Change to 6 after COOL, because the character length after LAURENCE is 9 characters. If you do not encrypt the character, the decryption cannot be parsed.
Root @ Server :~ /Php_screw-1.5 # vim my_screw.h
Short pm9screw_mycryptkey [] = {
11152,368,192,128 1, 62
Short pm9screw_mycryptkey [] = {
12852,968,192,128 1, 62,269
Custom encryption seed file, which may be the highlight of the program. Use your favorite text editor to open my_screw.h in the source code directory and modify the array file in the file, you can add the length of the array with numbers. The longer the array, the more reliable the encryption. In addition, the length of the array does not affect encryption and the speed at which your PHP program runs. The test shows that if the length is greater than 5 digits, decryption and resolution problems will occur.

6. phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

If your system prompts that you do not have this command, you need to install apt-get install php5-dev Centos which is estimated to be the yum-y install php5-devel. If you still prompt that the above command does not exist, probably because your php is not installed in the standard directory, go to the bin folder in the php installation directory and check whether the file exists. Return to the php_scre_1.5 directory and run
To successfully execute phpize, you must have the autoconf and M4 software packages. After successful execution, the configure file appears in the source code folder.
If there is no installation error: phpize command not found
Solution: centOS: yum-y install php-devel
: RHEL: up2date-I php-devel

7. Configuration
If php is installed in a non-standard directory, you need to check whether the php-config file exists in the phpize directory, and then execute the following directory:
./configure –with-php-config=/full/path/to/php-config

8. Installation
make install

Sometimes there is a problem:
'Zend _ compiler_globals' does not have the 'Extended _ info' member make: *** [php_screw.lo] Error 1
You need to modify php_screw.c (there are two areas to be adjusted)
Set CG (extended_info) to 1;
CG (compiler_options) | = ZEND_COMPILE_EXTENDED_INFO;

9. php configuration
Add extensions in the php. ini file
Vim/usr/local/php/etc/php. ini
Extension = php_scresponso
Restart apache and check the phpinfo () with php_screw information.

10. Go to the tools directory under the source code directory.
Here is the tool for compiling the php source code to the php encrypted file: screw

The above process has already completed the installation of php_screw. Let's take a look at how to encrypt it:
1. Switch to your php source code directory. For example, if you want to encrypt the phpinfo. php file, execute
#screw phpinfo.php

2. One disadvantage of php_screw_1.5 is that the screw encryption tool can only execute one file at a time. If you switch to your php source code directory for execution
# Screw *
No files will be encrypted. If you want to encrypt hundreds of files, it is a disaster.
The solution is as follows:
Find/data/php/source-name "*. php"-print | xargs-n1 screw // encrypt all. php files
Find/data/php/source-name "*. screw"-print | xargs-n1 rm // Delete the backup files of all. php source files
You can encrypt all files suffixed with php in the/path/to/php/source directory, including files in subdirectories.
In this way, the php source code is basically encrypted. If it's just the encryption of the personal applet source code, I think php_screw is a good choice.

Related Article

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: 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.