第一步:下載擴充套件檔案
root@iZ2ze4:/www/wwwroot# git clone https://github.com/lihancong/tonyenc.git
第二步:修改密文
在tonyenc資料夾下core.h檔案
第三步:生成擴充套件檔案
1、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
第四步:部署擴充套件
1、將擴充套件放到php的擴充套件目錄
2、修改php.ini 加入一行 重啟php
第五步:加密檔案
1、將需要加密的檔案 放到tonyenc資料夾下 當然了,你也可以選擇路徑去加密,那樣就直接把檔案改了,切記要複製一份!!
root@iZ2ze4vksr609c7jmh:/www/wwwroot/tonyenc# php tonyenc.php HookController.php
root@iZ2ze4vksr609c7jmh:/www/wwwroot/tonyenc#
2、執行成功之後,將檔案放回原位,提示是一個二進位制的檔案打不開,但是可以訪問使用,這就ok了!
本作品採用《CC 協議》,轉載必須註明作者和本文連結