php+zend guard

來源:互聯網
上載者:User

標籤:   設定檔   php程式   資料庫   應用程式層   

就本次DZ論壇密碼泄露進行了一次加密方式的調研,分享以下內容;

關於php 加密方式有兩種

1、代碼層加密

加密:對設定檔中資料庫的密碼字串進行加密,可採用mac、jason

解密:對所有需要讀取資料庫設定檔中密碼串的頁面所調用的方法,類添加對應的解密

優點:

對單個字串的加密,便於後續對線上代碼的靈活變動

缺點:

改動大消耗人力高

2、應用程式層加密

加密:採用zend guard 6.0 加密php檔案,或對整個工程進行加密;

解密:php+添加zend模組,php程式會自動解析加密後的檔案;

優點:

操作簡便

缺點:

對於後續設定檔修改等操作不便


官網下載加密程式http://www.zend.com/en/downloads(具體忘記了)ZendGuard-6_0_0.exe

官網下載解密模組http://www.zend.com/en/products/guard/thank-you-zend-guard?package=1518

安裝ZendGuard-6_0_0.exe

點擊file建立project

650) this.width=650;" border="0" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

設定項目名稱

650) this.width=650;" border="0" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

點擊ADDfile 選擇要加密的檔案

注意:加密檔案不可以和輸出檔案在同一目錄下,或存在父目錄與子目錄的關係

650) this.width=650;" border="0" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

配置php版本,zend6.0 預設輸出版本為PHP5.4  需要將 User global source options 勾選取消,然後選擇PHP version 5.3

650) this.width=650;" border="0" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

一切配置完畢後選擇工程點擊 ENcode

650) this.width=650;" border="0" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />

執行完畢後會在設定的輸出目錄產生加密後的同名php檔案,將加密後的檔案放置linux代碼中;

需要配置linux 伺服器上php添加ZEND模組,同時要確保與php版本匹配

將解密壓縮包解壓

#tar zxf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

將包中so檔案放入php-lib庫目錄中

cp  ZendGuardLoader.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626

添加php.ini配置如下

[Zend]

zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ZendGuardLoader.so"

zend_optimizer.enable_loader="1"

zend_optimizer.optimization_level="0"

zend_optimizer.disable_licensing="0"

重啟php即可


php+zend guard

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.