php 调用未定义的函数 dl()

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16163525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:38:00  来源:igfitidea点击:

Call to undefined function dl()

php

提问by Happy

I am using PHTML encoder to encode my php file but it is giving error "Call to undefined function dl()" when i run the encoded file. Somebody please help.

我正在使用 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);
    }
?>

回答by aleation

as @k102 mentioned dl()has been disabled by default since 5.3:

正如提到的@k102dl()自 5.3 以来默认已禁用:

as refered on the php documentation: http://php.net/manual/en/function.dl.php

如 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.

as suggested there, use the Extension Loading Directives instead: http://www.php.net/manual/en/ini.core.php#ini.extension

按照那里的建议,改用扩展加载指令:http: //www.php.net/manual/en/ini.core.php#ini.extension



Basically your only choices are:

基本上你唯一的选择是:

  1. Load the extension configuring it properly on the php.ini
  2. Use one of the mentioned SAPI's that still supports dl()as mentioned in the documentation: (CLI, CGI and Embed)
  3. Downgrade your php version if you really need to load it dinamically
  1. 在 php.ini 上正确加载扩展配置
  2. 使用dl()文档中提到的仍然支持的提到的 SAPI 之一:(CLI、CGI 和嵌入)
  3. 如果您确实需要动态加载它,请降级您的 php 版本