Home php教程 php手册 PHP-Beast 加密你的PHP源代码

PHP-Beast 加密你的PHP源代码

Jun 06, 2016 pm 08:10 PM
php encryption source code Talk about it first

首先说说为什么要用PHP-Beast? 有时候我们的代码会放到代理商上, 所以很有可能代码被盗取,或者我们写了一个商业系统而且不希望代码开源,所以这时候就需要加密我们的代码。 另外PHP-Beast是完全免费和开源的, 当其不能完成满足你的需求时, 可以修改其代码

首先说说为什么要用PHP-Beast?
有时候我们的代码会放到代理商上, 所以很有可能代码被盗取,或者我们写了一个商业系统而且不希望代码开源,所以这时候就需要加密我们的代码。
另外PHP-Beast是完全免费和开源的, 当其不能完成满足你的需求时, 可以修改其代码而满足你的要求。

1. PHP-Beast的安装

$ wget https://github.com/liexusong/php-beast/archive/master.zip
$ unzip master.zip
$ cd php-beast-master
$ phpize
$ ./configure
$ make
$ sudo make install
Copy after login

注意:在编译扩展之前先修改加密的key,如下图。

143433_T6LJ_119031

编译好之后修改php.ini配置文件,加入配置项:extension=beast.so,重启php-fpm。

安装完成后可以在phpinfo中看到如下结果:

143013_2WTq_1190312. 安装好PHP-Beast模块后,可以使用工具包中的encrypt_project.php工具来加密你的项目,你只需要输入项目的路径和输出的项目路径即可(这个工具只会加密PHP文件,其他文件只会简单的复制),如:

143102_2ZJz_119031加密完成后使用文本编辑器看编译后的文件可以发现已经变为乱码,如:

143126_o1mC_119031

3. 当然你可能不希望加密项目的所有PHP源文件,所以你可以使用PHP-Beast模块提供的beast_encode_file()函数来加密其中的某个 文件,使用方法:beast_encode_file($input_file, $output_file),$input_file是要加密的文件,$output_file是要输出加密后的文件。

4. 把源码加密后就可以放到服务器上运行了。另外PHP-Beast模块提供缓存功能,我们可以在php.ini文件中修改缓存的大小来控制PHP-Beast模块可以使用的缓存。如:

[beast]
beast.cache_size = 20000
Copy after login

我们可以使用beast_cache_status()函数来查看缓存的状态。

最新的PHP-Beast 0.6主要修改了一些bug和增加了一些配置项:

1. 设置缓存大小可以使用单位, 例如: beast.cache_size = 10m;

2. 可以在配置文件中禁止beast模块, 例如: beast.enable = Off;

3. 增加了日志记录功能, 可以使用beast.log_file配置项指定日志文件.

4. 使用文件锁解决原来信号量锁导致的bug, 可以使用beast.lock_path来指定锁路径.

无觅相关文章插件,快速提升流量

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

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

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

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

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

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

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

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

Get the gate.io installation package for free Get the gate.io installation package for free Feb 21, 2025 pm 08:21 PM

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

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

List of top ten exchanges in the currency circle List of top ten exchanges in the currency circle Feb 21, 2025 pm 10:18 PM

The top ten exchanges in the currency circle are ranked by trading volume: Binance Ouyihuobi FTXKrakenCoinbaseGeminiBitfinexBybitGate.io

See all articles