php5 中 $HTTP_POST_VARS 不能用
發表於 : 2009-02-25 10:03:37
1.改 php.ini
register_globals On On
register_long_arrays On
2.改用新的寫法
$_SERVER
$_GET
$_POST
http://www.backup.idv.tw/viewtopic.php? ... 260f1edd51
如果你的網站跟本站一樣....
1. 使用舊版 phpBB
2. 使用 FreeBSD OS
3. 想從 php4.x 升級到 php5.x (因 php4 即將 end of life 了)
轉載自 http://www.php.net/
代碼:
PHP 4 end of life announcement
[13-Jul-2007]
Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.
The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.
For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.
4. 具備自行從 php4.x 升級到 php5.x 的能力
5. 不想去變動 php.ini 中的設定 (設定 register_long_arrays = On ... php5 效能會變差)
你可以快速的利用下面的指令.... 修改 phpBB 中舊的 php 語法
讓舊版的 phpBB 程式支援 php5.x....
1. 請先備份你的 phpBB 程式
2. 將下列的文字儲存成一個 script 後執行
代碼:
#!/bin/sh
#phpBB 的存放路徑
cd /usr/local/www/data/phpBB2/
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_GET_VARS/\$_GET/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_POST_VARS/\$_POST/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_SERVER_VARS/\$_SERVER/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_COOKIE_VARS/\$_COOKIE/g'
3. 舊版 phpBB 就能在 php5.x 下正常運行囉
register_globals On On
register_long_arrays On
2.改用新的寫法
$_SERVER
$_GET
$_POST
http://www.backup.idv.tw/viewtopic.php? ... 260f1edd51
如果你的網站跟本站一樣....
1. 使用舊版 phpBB
2. 使用 FreeBSD OS
3. 想從 php4.x 升級到 php5.x (因 php4 即將 end of life 了)
轉載自 http://www.php.net/
代碼:
PHP 4 end of life announcement
[13-Jul-2007]
Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.
The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.
For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.
4. 具備自行從 php4.x 升級到 php5.x 的能力
5. 不想去變動 php.ini 中的設定 (設定 register_long_arrays = On ... php5 效能會變差)
你可以快速的利用下面的指令.... 修改 phpBB 中舊的 php 語法
讓舊版的 phpBB 程式支援 php5.x....
1. 請先備份你的 phpBB 程式
2. 將下列的文字儲存成一個 script 後執行
代碼:
#!/bin/sh
#phpBB 的存放路徑
cd /usr/local/www/data/phpBB2/
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_GET_VARS/\$_GET/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_POST_VARS/\$_POST/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_SERVER_VARS/\$_SERVER/g'
/usr/bin/grep -R \$HTTP_ * | /usr/bin/cut -d ":" -f 1 | /usr/bin/sort -u | /usr/bin/xargs -n 1 perl -pi -e 's/\$HTTP_COOKIE_VARS/\$_COOKIE/g'
3. 舊版 phpBB 就能在 php5.x 下正常運行囉