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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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 is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.
