2013-04-23 26 views
1

我使用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

回答

2

爲@ 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