發新話題
打印

PHP 4.X 升級到PHP 5.X 版的環境變數設定不一樣

PHP 4.X 升級到PHP 5.X 版的環境變數設定不一樣

不知道您有沒有4.X版的程式移植到PHP 5.X 版時...怎麼不會動的經驗嗎?
最近剛好有一支使用 $HTTP_POST_VARS 這樣變數的程式...因為在4.x版
時都正常...就是在 PHP5.x 不會動...Web的 error_log 錯誤訊息為...

PHP Notice: Undefined variable: HTTP_POST_VARS

後來弄了好久才找到這個地方的問題 /etc/php.ini :
複製內容到剪貼板
代碼:
; - register_long_arrays = Off     [Performance]
;     Disables registration of the older (and deprecated) long predefined array
;     variables ($HTTP_*_VARS).  Instead, use the superglobals that were
;     introduced in PHP 4.1.0
將 register_long_arrays = Off 改為 register_long_arrays = On
就可以使用舊版的環境變數

轉文自:http://www.adj.idv.tw/phpBB2/viewtopic.php?t=1816

TOP

發新話題