php_screw安装使用教程(另一个PHP代码加密实现)
开始之前,首先要澄清两个问题:第一,支持开源,不等于反对代码加密;第二,如果把不属于自己的东西(比如公司的)拿去开源,就更加不应该了。
以前知道的,PHP代码的加密都是用Zend的encoder,这东西不但是商业软件,好像还暴出过能够被破解的问题,所以就找到了替代的方案────php_screw,一个日本人开发的东东。
php_screw非常小巧,没有仔细看过它的算法,但从说明文档中看,可以自行更改SEED,然后自行编译so和可执行档。如果够牛的话,甚至可以自己去更改算法。不管怎样,对于我们这些“普通人”来说,这种加密应该就够了吧,如果真想滴水不漏,那还是不要公开的好,虽然作者说的并不是很容易就破解,但指不定哪儿有牛群呢不是么?
安装的环境需要:PHP5.x,zlib开启,autoconf,automake已安装。
测试环境:Ubuntu 8.04 hardy, PHP 5.2.3。
下载地址:http://sourceforge.net/projects/php-screw/
1、 解压,更改my_screw.h,里面的几个数字就是SEED,相当于密码,可以随意更改、增加,并且数字的多少不影响解密的速度。
2、编译so文件:
复制代码 代码如下:
$ phpize
$ ./configure
$ make
如果出现这样的错误,那是因为autoconf没有安装:
复制代码 代码如下:
$ make
make: *** No targets specified and no makefile found. Stop.
3、安装so文件,编译好的文件在modules目录下,将其拷贝到php extension存放的位置,比如/usr/lib/php5/20060613+lfs下,然后在php.ini中增加:
复制代码 代码如下:
extension = php_screw.so
4、编译用来加密文件的可执行文件:
复制代码 代码如下:
$ cd tools
$ make
tools目录下新生成的screw就是了,放到$PATH中就可以调用了,比如要加密一个文件:
复制代码 代码如下:
$ screw a.php
Success Crypting(a.php)
加密后的a.php执行正常,同时screw还会把原来没有加密的文件改名为.screw文件作为备份。
Update @ 2008-09-01
加密之后,还有个小问题,用require或include引用放在include_path下的加密代码时,会当做明文引过来,解决方法有两种:
使用绝对路径引用放在include_path下的加密内容,如果是自己的主机,肯定没问题的;
使用相对路径来引用,比如在本项目的子目录内,这样也是没问题的。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
