php-tonyenc加密擴展使用方法

1、下載擴展文件

root@iZ2ze4:/www/wwwroot# git clone https://github.com/lihancong/tonyenc.git
cd tonyenc

2、輸入命令 phpize

root@iZ2ze4vksr60:/www/wwwroot/tonyenc# phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718

3、輸入命令 find / -name php-config 獲取到路徑

root@iZ2ze4vksrZ:/www/wwwroot/tonyenc# find / -name php-config
/www/server/php/72/bin/php-config

4、輸入命令 ./configure --with-php-config=/www/server/php/70/bin/php-config 加黑的就是 find / -name php-config找到的php的路徑

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
 

5、輸入命令make 命令完會生成一個modules/tonyenc.so 文件的文件

Libraries have been installed in:
   /www/wwwroot/tonyenc/modules
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test

6、輸入命令 make test
7、進入提示的目錄 /www/wwwroot/tonyenc/modules 把tonyenc.so 復(fù)制到php擴展文件中

cp tonyenc.so /www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/

8、修改php.ini extension=tonyenc.so 重啟php
9、就可以使用命令加密了

代碼中的 tonyenc.php 是加密工具:

      php tonyenc.php example.php dir/

    這樣即可加密 example.php 和 dir 目錄下的所有 php 文件,PHP 在運行它們時會自動解密,夠簡單吧!
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容