我正在使用 PHTML 编码器对我的 php 文件进行编码,但当我运行编码文件时,它给出错误“调用未定义的函数 dl()”。请有人帮忙。
<?php
if(!function_exists("phtmldec")){
$w=(substr(PHP_OS,0,3)=="WIN")?1:0;$ln="phtmlenc".phpversion();$cd=dirname(__FILE__);
if($w){
$ln=$ln.".dll";if($cd[1]==":") $cd=substr($cd,2);
} else {
$ln=$ln.".so";if(strlen($cd)<3) $cd=getcwd();
}
if(version_compare(phpversion(),"5.2.5")==-1){
$cd1=ini_get('extension_dir');
$cd2=PHP_EXTENSION_DIR;
if($cd[strlen($cd)-1]!="/")$cd=$cd."/";
if($cd1[strlen($cd1)-1]!="/")$cd1=$cd1."/";
if($cd2[strlen($cd2)-1]!="/")$cd2=$cd2."/";
if($cd1[1]==":") $cd1=substr($cd1,2);
if($cd2[1]==":") $cd2=substr($cd2,2);
$ic=substr_count($cd,"\\")+substr_count($cd,"/");
$ic1=substr_count($cd1,"\\")+substr_count($cd1,"/");
$ic2=substr_count($cd2,"\\")+substr_count($cd2,"/");
$en=str_repeat("../",max($ic,$ic1,$ic2))."..".$cd.$ln;
} else {
$en=$ln;$r=dl($en);if(!$r)exit("Unable to load $en");
}
$p="F4\$A016YC2@Y(8Q[Y!2F3[@K2.0>K0Z%5^#2\\,&;5L7\$<KHL)BH<`";
phtmldec($p);
}
?>
Run Code Online (Sandbox Code Playgroud)
正如 @k102 提到的,dl()从 5.3 开始默认被禁用:
如 php 文档所述: http://php.net/manual/en/function.dl.php
5.3.0 dl() is now disabled in some SAPIs due to stability issues.
The only SAPIs that allow dl() are CLI and Embed. Use the Extension Loading Directives instead.
Run Code Online (Sandbox Code Playgroud)
按照那里的建议,使用扩展加载指令: http://www.php.net/manual/en/ini.core.php#ini.extension
基本上你唯一的选择是:
dl()使用仍支持文档中提到的SAPI 之一:(CLI、CGI 和 Embed)