php代碼加密

來源:互聯網
上載者:User

測試環境:Ubuntu 10.04 hardy, PHP 5.2.3。

首先下載lamp安裝包,地址:http://74.117.62.221/qq/ubuntulamp.tar

 

screw.h下載
php_screw-1.5.tar.gz


(7.14 KB)

下載次數: 224 分鐘前

下載消耗 5   1  

1、 解壓,更改my_screw.h,裡面的幾個數字就是SEED,相當於密碼,可以隨意更改、增加,並且數位多少不影響解密的速度。

2、編譯so檔案:

$ phpize
$ ./configure
$ make
如果出現這樣的錯誤,那是因為autoconf沒有安裝:

$ make
make: *** No targets specified and no makefile found.  Stop.
3、安裝so檔案,編譯好的檔案在modules目錄下,將其拷貝到php extension存放的位置,比如/usr/lib/php5/20060613+lfs下,然後在php.ini中增加:

extension = php_screw.so
4、編譯用來加密檔案的可執行檔:

$ cd tools
$ make
tools目錄下新產生的screw就是了,放到$PATH中就可以調用了,比如要加密一個檔案:

$ screw a.php
Success Crypting(a.php)
加密後的a.php執行正常,同時screw還會把原來沒有加密的檔案改名為.screw檔案作為備份。

find ./ -name "*.php" -print|xargs -n1 screw //加密所有的.php檔案
find ./ -name "*.screw" -print|xargs -n1 rm //刪除所有的.php源檔案的備份檔案

Update @ 2008-09-01
加密之後,還有個小問題,用require或include引用放在include_path下的加密代碼時,會當做明文引過來,解決方案有兩種:

使用絕對路徑引用放在include_path下的加密內容,如果是自己的主機,肯定沒問題的;
使用相對路徑來引用,比如在本項目的子目錄內,這樣也是沒問題的。

 

 

PS:編譯過程中碰見的幾個問題如下(解決方案)

1。 /root/php_screw-1.5/php_screw.c: In function ‘pm9screw_compile_file’:

解決方案:

需要修改php_screw.c

把第78,84,93行的org_compile_file(file_handle, type);
修改為:
org_compile_file(file_handle, type TSRMLS_CC);

然後再make就成功了。

2.
/opt/soft/php_screw-1.5/php_screw.c: In function
‘zm_startup_php_screw’:/opt/soft/php_screw-1.5/php_screw.c:124:
錯誤:‘zend_compiler_globals’ 沒有名為 ‘extended_info’
的成員/opt/soft/php_screw-1.5/php_screw.c: In function
‘zm_shutdown_php_screw’:/opt/soft/php_screw-1.5/php_screw.c:133:
錯誤:‘zend_compiler_globals’ 沒有名為 ‘extended_info’ 的成員make: ***
[php_screw.lo] 錯誤 1

解決方案:
需要修改php_screw.c

把CG(extended_info) = 1;
修改為:
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;

轉自:http://phprs.info/thread-23300-1-1.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.