PHP-Beast 加密你的PHP源代码
首先说说为什么要用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
注意:在编译扩展之前先修改加密的key,如下图。
编译好之后修改php.ini配置文件,加入配置项:extension=beast.so,重启php-fpm。
安装完成后可以在phpinfo中看到如下结果:
2. 安装好PHP-Beast模块后,可以使用工具包中的encrypt_project.php工具来加密你的项目,你只需要输入项目的路径和输出的项目路径即可(这个工具只会加密PHP文件,其他文件只会简单的复制),如:
加密完成后使用文本编辑器看编译后的文件可以发现已经变为乱码,如:
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
我们可以使用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来指定锁路径.
原文地址:PHP-Beast 加密你的PHP源代码, 感谢原作者分享。

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

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.

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

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

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.

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

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