Zend Guard是目前市面上最成熟的PHP源碼加密產品了。 剛好需要對自己的產品進行加密,折騰了一晚上,終於搞定,將碰到的問題及解決方法記錄下來,方便日后需要,也可以幫助其他人。 我使用的是Wampserver,其中php的版本是5.3.10。
Zend Guard Run-time support missing!
One more more files on this web site were encoded by ZendGuard and the required run-time support is not installed orproperly configured.
For the Web site user
This means that this Web server is not configured correctly to runthe files that it contains. Please contact the Web site'sadministrator/webmaster and inform them of this problem and give themthe URL you are trying to display to help them in diagnosing theproblem.
For The Site Administrator/Web Master
One or more files on your site were encoded with Zend Guard. Thismay be third party libraries that were provided to you by an ISV. Toallow these files to properly run you need to download and installone of the Zend guard run-time libraries. This is either ZendOptimizer or Zend Loader. The proper files can be downloaded fromhttp://www.zend.com/guard/downloads.This software is provided free of charge.
General Disclaimer: Zend Technologies is not responsible tothe configuration and setup of web sites using Zend Guard technology.Please contact your software vendor if these components were providedby an ISV or consult your Zend Guard Users Guide if these files wereencoded by your organization.
Zend Guard的安裝及破解
點擊下載Zend Guard5.5.0,下載完成后,請自行傻瓜化安裝 這里需要注意以下幾點: 1、本KEY的有效時間為2010年7月10號,因此激活時請將自己電腦系統時間調整至這個時間以前 2、本KEY激活的為試用版,加密過的文件只有14天有效時間,因此在加密文件時,請將自己電腦系統時間向后調整N年,比如2099-12-31 3、下載授權文件[zend_guard授權文件.zip],解壓得到zend_guard.zl,即為激活用的文件 4、打開Zend Guard 5.5.0,[Help]->[Register]->[Search for a license file on my disk],選擇文件激活即可。
如何使用Zend Guard進行加密?
1、打開Zend Guard 5.5.0,[File]->[New]->[Zend Guard Project],新建項目 2、在彈窗的窗口,前3項隨便填吧,最后一項是加密后文件的保存位置,然后[Next]; 3、本步驟是選擇要加密的文件,可以為單個文件[Add File]和整個文件夾[Add Folder],然后[Next] 4、接下來是選擇PHP版本[與你服務器上PHP的版本相對照],這里很重要,版本不對會出錯,[Finish]完成項目的創建 5、在Zend Guard左側的Guard Explorer中,可以看到你新建的項目了,鼠標選中后,右鍵[Encode Project],完成
Zend Guard Run-time support missing問題的解決
雖然現在可以成功加密php源碼了,但是當執行腳本的時候,會發現不能正常執行,會顯示如下信息
Zend Guard Run-time support missing! One more more files on this web site were encoded by ZendGuard and the required run-time support is not installed orproperly configured. ......
原來,加密后的php代碼需要ZendGuardLoader模塊才能正常運行。 因為我的php版本是5.3.10的,所以我這里只提供了ZendGuardLoader-php-5.3-Windows,如果是其他版本的php,請自行百度。 點擊下載ZendGuardLoader-php-5.3-Windows 下載好后解壓壓縮包,找到目錄下的 ZendLoader.dll 文件,將它放到你的php目錄下ext下,再編輯php.ini文件,添加一段代碼(如):
[Zend.loader] zend_loader.enable=1 zend_loader.disable_licensing=1 zend_loader.obfuscation_level_support=3 zend_loader.license_path= zend_extension="你的PHP安裝目錄\ext\ZendLoader.dll"
重啟wampserver 運氣好的話,會發現可以成長執行了,運氣不好的話,還是會發現以上錯誤。 這里我們已經安裝了zend guard loader了,為什么還是無法執行zend加密后的php腳本呢? 通過查看輸出phpinfo()信息,我發現有這么幾行信息:
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,TS,VC9
請注意,其中的TS是thread safety的簡寫(即線程安全) 一時也找不出原因,索性直接打開zend guard官網進行搜索,然后就解決了。 原來,zend guard loader只支持NTS的版本,意味着如果你的php版本是TS的話,就沒法使用zend guard loader了,如果你想查看自己的php是ts還是nts的,只需要輸出phpinfo,然后搜索下:Thread Safety,disabled對應nts版本,否則為ts。 因此,終極解決辦法就是,下載個php NTS版本進行安裝即可。
參考資料
ZendGuard 5.5.0 破解方法+注冊文件KEY下載
Windows下PHP(Thread Safe與Non Thread Safe)版本說明
PHP中VC6、VC9、TS、NTS版本的區別與用法詳解
VC6版本是使用Visual Studio 6編譯器編譯的,如果你的PHP是用Apache來架設的,那你就選擇VC6版本。
VC9版本是使用Visual Studio 2008編譯器編譯的,如果你的PHP是用IIS來架設的,那你就選擇 VC9版本。
VC9版本是針對IIS服務器的版本,沒有對APACHE的支持,而VC6版本對IIS和apache都提供了支持
2.Ts與nts的區別:
Windows版的PHP從版本5.2.1開始有Thread Safe和NoneThread Safe之分。
先從字面意思上理解,Thread Safe是線程安全,執行時會進行線程(Thread)安全檢查,以防止有新要求就啟動新線程的CGI執行方式而耗盡系統資源。Non Thread Safe是非線程安全,在執行時不進行線程(Thread)安全檢查。
3.PHP的兩種執行方式:ISAPI和FastCGI。
ISAPI執行方式是以DLL動態庫的形式使用,可以在被用戶請求后執行,在處理完一個用戶請求后不會馬上消失,所以需要進行線程安全檢查,這樣來提高程序的執行效率,所以如果是以ISAPI來執行PHP,建議選擇ThreadSafe版本;
而FastCGI執行方式是以單一線程來執行操作,所以不需要進行線程的安全檢查,除去線程安全檢查的防護反而可以提高執行效率,所以,如果是以FastCGI來執行PHP,建議選擇NonThread Safe版本。
通過phpinfo(); 查看其中的 Thread Safety 項,這個項目就是查看是否是線程安全,如果是:enabled,一般來說應該是ts版,否則是nts版。
http://windows.php.net/downloads/releases/archives/
http://windows.php.net/downloads/releases/archives/
Thursday, January 22, 2015 4:24 AM 22349178 php-5.6.5-nts-Win32-VC11-x64.zip
Thursday, January 22, 2015 4:20 AM 20967629 php-5.6.5-nts-Win32-VC11-x86.zip
Thursday, January 22, 2015 4:20 AM 24203808 php-5.6.5-src.zip
Thursday, January 22, 2015 4:20 AM 22499875 php-5.6.5-Win32-VC11-x64.zip
Thursday, January 22, 2015 4:24 AM 21072883 php-5.6.5-Win32-VC11-x86.zip
Thursday, February 19, 2015 2:45 AM 22355533 php-5.6.6-nts-Win32-VC11-x64.zip
Thursday, February 19, 2015 2:45 AM 20970976 php-5.6.6-nts-Win32-VC11-x86.zip
Thursday, February 19, 2015 2:45 AM 24355788 php-5.6.6-src.zip
Thursday, February 19, 2015 2:45 AM 22501845 php-5.6.6-Win32-VC11-x64.zip
Thursday, February 19, 2015 2:45 AM 21072108 php-5.6.6-Win32-VC11-x86.zip
Friday, March 20, 2015 12:50 AM 22385183 php-5.6.7-nts-Win32-VC11-x64.zip
Friday, March 20, 2015 12:50 AM 21003115 php-5.6.7-nts-Win32-VC11-x86.zip
Friday, March 20, 2015 12:50 AM 24376286 php-5.6.7-src.zip
Friday, March 20, 2015 12:50 AM 22536069 php-5.6.7-Win32-VC11-x64.zip
Friday, March 20, 2015 12:50 AM 21103137 php-5.6.7-Win32-VC11-x86.zip
Thursday, April 16, 2015 1:46 AM 22397288 php-5.6.8-nts-Win32-VC11-x64.zip
Thursday, April 16, 2015 1:46 AM 21009390 php-5.6.8-nts-Win32-VC11-x86.zip
Thursday, April 16, 2015 1:46 AM 24422529 php-5.6.8-src.zip
Thursday, April 16, 2015 1:46 AM 22547895 php-5.6.8-Win32-VC11-x64.zip
Thursday, April 16, 2015 1:46 AM 21113312 php-5.6.8-Win32-VC11-x86.zip