Install php-beast module under centos7
Step 1: Install the php-beast extension in php
The basic process is as follows:
$ wget https://github.com/liexusong/php-beast/archive/master.zip
$ unzip master.zip
$ cd php-beast-master
$ phpize
$ ./configure
$ make
$ sudo make install
How to solve the error when executing phpize?
If the following error occurs
Can't find PHP headers in /usr/include/php The php-devel package is required for use of this command
It means that you have not installed the php-devel extension package. phpize is used to extend the php extension module. Through phpize, you can create a php plug-in module . phpize is the content of php-devel, so just run yum install php-devel.
### 首先查看php版本 php -v ### 获取php版本后安装指定版本的devel扩展包 如 php7.0版本执行 yum install php70w-devel
How can I confirm that the installation was successful?
Check whether the extension exists in the php extension directory.
make install
After completion, there will be a php module directory. Go in to see if there is abeast.so
file
Step 2: Add the PHP extension to the PHP configuration file
- Modify php.ini to add configuration: extension=beast.so, run php -m to see if the extension is added successfully
- restart the server
Step 3: Encrypt with php-beast extension
The downloaded tarball contains the tools directory, which is the tool used for encryption.
There is an encode_file.php file, which is a tool used to encrypt a single file
$ php encode_file.php --oldfile old_file_path --newfile new_file_path --encrypt DES --expire "2016-10-10 10:10:10"
There is an encode_files.php file that is used to encrypt folders.
### 先配置好configure.ini
$ php encode_files.php
Related configuration
beast.cache_size = size
beast.log_file = "path_to_log"
beast.log_user = "user"
beast.log_level = "debug"
beast.enable = On
beast.log_level supports parameters:
- DEBUG
- NOTICE
- ERROR
The supported modules are:
- AES
- FROM
- Base64
for extension development
This module is open source, so the source code can be customized privately. For details, please refer to: the author's github