screw-plus实现php代码安全

1.下载screw-plus安装包

git clone https://git.oschina.net/splot/php-screw-plus.git
mv php-screw-plus /usr/local/src/

2.php添加php-screw-plus模块,在编译之前可以在php_screw_plus.h文件指定CAKEY,最好选择一个足够复杂的16位的key值,提高加密复杂度

/usr/local/php/bin/phpize

# 编译解密程序
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

# 编译加密程序
cd tools/
make

# 修改php配置文件,指定扩展路径
vim /usr/local/php/etc/php.ini
# 这样写是需要有extension_dir的,建议添加这个,方便之后指定扩展路径
extension = php_screw_plus.so

3. 重启php,查看模块

service php-fpm restart
# 有内容就表示扩展成功
php --re php_screw_plus

4.测试加密

mkdir /test

vim /test/test.php
<?php
phpinfo()
?>

# 加密/test目录下的所有php文件
cd /usr/local/src/php_screw_plus/tools
./screw /test

# 查看是乱码,就表示加密成功
cat /test/test.php
原文地址:https://www.cnblogs.com/chenpingan/p/10631679.html