0

我想知道是否可以创建一个加载程序文件来处理加载 ioncube 加载程序。通常的方法是编码文件尝试检测 ioncube loader,如果找不到则抛出错误:

if(!extension_loaded('ionCube Loader')){$__oc=strtolower(substr(php_uname(),0,3));$__ln='ioncube_loader_'.$__oc.'_'.substr(phpversion(),0,3).(($__oc=='win')?'.dll':'.so');if(function_exists('dl')){@dl($__ln);}if(function_exists('_il_exec')){return _il_exec();}$__ln='/ioncube/'.$__ln;$__oid=$__id=realpath(ini_get('extension_dir'));$__here=dirname(__FILE__);if(strlen($__id)>1&&$__id[1]==':'){$__id=str_replace('\\','/',substr($__id,2));$__here=str_replace('\\','/',substr($__here,2));}$__rd=str_repeat('/..',substr_count($__id,'/')).$__here.'/';$__i=strlen($__rd);while($__i--){if($__rd[$__i]=='/'){$__lp=substr($__rd,0,$__i).$__ln;if(file_exists($__oid.$__lp)){$__ln=$__lp;break;}}}if(function_exists('dl')){@dl($__ln);}}else{die('The file '.__FILE__." is corrupted.\n");}if(function_exists('_il_exec')){return _il_exec();}echo('Site error: the file <b>'.__FILE__.'</b> requires the ionCube PHP Loader '.basename($__ln).' to be installed by the website operator. If you are the website operator please use the <a href="http://www.ioncube.com/lw/">ionCube Loader Wizard</a> to assist with installation.');exit(199);

根据宿主环境,ioncube 加载器是通过例如声明它为 ZendExtension 的 php.ini 文件插入的。是否可以将 ZendExtenion 的加载直接移植到 php 文件并将加载器捆绑到 php 文件而不是安装 ioncube 加载器?

4

1 回答 1

1

并不真地。PHP 曾经有一个名为 dl() 的函数,它可以即时安装 PHP 模块,这就是 ionCube 编码文件开头的代码使用它的“运行时加载”机制。加载程序可以与应用程序捆绑在一起,并且应用程序通常无需任何安装更改即可运行,这很棒。PHP 5.2.5 中的一些更改对这种机制产生了一些影响,但 dl() 在 PHP 5.3 中确实变得不那么有用了,因为它从一些 SAPI 中被删除了。该机制仍然适用于某些服务器,但现在通常需要安装 php.ini。

于 2014-03-13T14:02:36.503 回答