セッション機能のテストで以下のソースを動かした所、エラーが発生。又はカウントアップ
スクリプトが動作しない現象が確認された。

テスト用PHPソース
<?
  session_start();
  if (!isset($count)) $count=0;
  session_register("count");
  $count++;
?>
<html>
<body>
あなたは <?= $count ?> 回目の訪問です。
<a href="<?echo $PHP_SELF ."?PHPSESSID=". $PHPSESSID?>">カウントを増や す</a>
</body>
</html>

エラー(ブラウザに表示)内容
Warning: Unknown: Your script possibly relies on a session sideeffect
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

対策
1./usr/local/lib/php.iniの修正
 register_globals = Off  <--修正前
 register_globals = On   <--修正後  <---- カウントアップできない場合
 下記設定も変更したほうがいいみたいです
 session.use_trans_sid = 0  <---修正前
 session.use_trans_sid = on <---修正後
2.apacheを再起動して設定反映
最終更新:2008年07月07日 08:55