调用未定义的函数dl()

调用未定义的函数dl()

问题描述:

我使用PHTML编码器来编码我的php文件,但是当我运行编码文件时,它给出错误“调用未定义的函数dl()”。 有人请帮忙。调用未定义的函数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\[email protected](8Q[Y!2F3[@K2.0>K0Z%5^#2\\,&;5L7\$<KHL)BH<`"; 
     phtmldec($p); 
    } 
?> 
+3

'dl'默认情况下,自5.3 – k102 2013-04-23 07:36:17

+0

禁用我只是整理了一下你的代码,你有一个STA rting大括号{缺少(在最后一个else后面)和一个括号大括号}在代码结尾缺少。 – aleation 2013-04-23 07:44:02

+0

@aleation但是仍然给出同样的错误。 – Happy 2013-04-23 07:50:38

为@ K102提到dl()已经默认,因为5.3禁用: 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. 

的建议有,使用功能扩展加载指令代替:

php的文件作为refered : http://www.php.net/manual/en/ini.core.php#ini.extension


基本上你唯一的选择是:

  1. 加载扩展正确配置它在php.ini中
  2. 使用提到的SAPI,如文档中提到,还支持dl()之一: (CLI,CGI和嵌入)
  3. 降级你的PHP版本,如果你真的需要加载它dinamically
+0

我使用'dl(php_curl)'(dinamyc加载)来启用php_curl时使用'php -f file.php'方法(CLI提到)和比编辑原始的php.ini更快,并创建一个新的php.ini,然后用'-c/path/php.ini'加载它。因为CLI传递文件名为$ argv [0],只需要用'if(@!empty($ argv))dl('php_curl');'加载它来检查非空格$ argv。 – erm3nda 2015-03-04 07:25:43