https://github.com/imaben/php-beast-binaries
windows下 可以直接在这里下载dll
根据自己的php版本 还有是不是线程安全的 来选择下载对应的
放到对应的扩展目录 中
在配置文件 php.ini中加入扩展配置
放到对应的扩展目录 中
在配置文件 php.ini中加入扩展配置
extension=php_beast_x86_nts.dll
加密方案:
使用beast_encode_file()
函数加密文件,函数原型如下:beast_encode_file(string $input_file, string $output_file, int expire_timestamp, int encrypt_type)
。
1. $input_file: 要加密的文件 2. $output_file: 输出的加密文件路径 3. $expire_timestamp: 文件过期时间戳 4. $encrypt_type: 加密使用的算法(支持:BEAST_ENCRYPT_TYPE_DES、BEAST_ENCRYPT_TYPE_AES)
echo beast_encode_file('D:\phpStudy\WWW\phpinfo.php','D:\phpStudy\WWW\z.php');/**要加密的文件路径,加密后的文件路径*/
centos配置php-beast扩展
1)安装
$ wget https://github.com/liexusong/php-beast/archive/master.zip
$ unzip master.zip
$ cd php-beast-master
$ phpize
$ ./configure
$ make
$ sudo make install
2)修改php.ini 添加配置:extension=beast.so
3)重启服务器
4)加密PHP文件 使用模块提供的beast_encode_file($input_file, $output_file);来加密文件,$input_file为要加密的文件,$output_file为要输出的加密文件。
5)把加密好的文件放到服务器上运行。