background image

PHP

教程 如何用 php screw 加密 php 源代码

本文为大家共同分享了用 php_screw 加密 php 源代码,需要的朋友参考下

在使用 PHP 过程中发现,自己编写的 php 代码因为都是源代码方式放在服务器上的所以
很容易就被别人拿走随便修改(变成自己开发的)使用了。
为了保住自己的劳动成果,我一直寻找一种可以加密 php 代码的软件。
最著名的就是 Zend 公司的 Zendencoder 了,但是不是开源软件(要价很高,也没有找到
破解版)。
既然收费的用不起,我们就用开源的。我找到了 php_screw 这个开源软件,目前最新版本
是 1.5
安装环境

系统:centos 5.3
软件:Apache 2.2.9
PHP 5.2.10

以上环境全部是自己下载配置安装的。具体的 Apache+php+mysql 安装方法请从网上搜索。
安装

1.用 tar

 

解压缩 tar -zxvf php_screw-1.5.tar.gz

2.进入 php_screw-1.5 目录开始安装

cd php_screw-1.5
phpize
关于 phpize ,它在 php5-dev

 

扩展模块中 只要安装 php5-dev 模块就行了。

./confiugre

3.设置自己用来加密的密码

vi my_screw.h
-- Please change the encryption SEED key (pm9screw_mycryptkey) into the
values according to what you like.
The encryption will be harder to 

break

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 will be possible. But in general, this should not
be necessary.
OPTIONAL: Encrypted scripts get a stamp added to the beginning of the
file. If you like, you may change this 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.编译

make

5.拷贝 modules 目录下的 php_screw.so 文件到/usr/lib/php5/extension 目录下