Warning:Unknown:Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. ....

  • 601
  • 0
  • PHP
  • 2015-12-10

Warning:Unknown:Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. ....

當撰寫PHP程式碼,

設定Session

例如: $_SESSION['var1']=null;

發生下述警告訊息

Warning:Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

 

解決方法一:

更新PHP到最新版本。

 

 

解決方法二:

在程式碼最上方加上下面兩行

ini_set('session.bug_compat_warn', 0);

ini_set('session.bug_compat_42', 0);
 
 
 
解決方法三:
 
在php.ini加上下面兩行
session.bug_compat_42 = 1
session.bug_compat_warn = 0
 
 
以上三種方法都可以解決這個警告問題,當然最佳的是更新PHP到最新版本。

 

 

參考或是複製語法時,別忘了留個言喔 ^ ^ ~