Menu

#3 yapbb doesn't work by default with recent php (> 4.2)

open
nobody
None
5
2014-08-27
2003-06-10
No

YapBB assumes register_globals is true, which it is no
longer since > 4.2. See
http://www.php.net/manual/en/configuration.directives.php#ini.register-globals.
This makes it behave very strangely, such as logging
in redirects you back to the login page, etc. The
quick fix is to place a .htaccess file in the YapBB
directory like the following:

<IfModule mod_php4.c>
php_flag register_globals on
</IfModule>

One additional problem is that $PHP_SELF isn't global
(anymore? I don't know), you need to use
$_SERVER['PHP_SELF'], so you need to apply the
following diff to include/global.php to make it exist
globally:

diff -r -b
/home/kehlets/ports/YapBB-1.2-Beta-Release/YapBB/include/global.php
YapBB/include/global.php
610a611,612
> global $PHP_SELF;
>
967a970,982
>
//=====================================================================================================================
> // Adjust $PHP_SELF for Win32 systems with PHP as CGI
installed
> // kehlets: this must appear first because $PHP_SELF
doesn't exist in PHP
> // anymore, it's $_SERVER['PHP_SELF'], so we make it
exist. Don't forget
> // to define it as a global var in any functions.
>
//=====================================================================================================================
>
> if ($tmp = getenv('SCRIPT_NAME'))
> $PHP_SELF = eregi_replace($tmp . "(/.*)",
"\\1", $_SERVER['PHP_SELF']);
> else
> $PHP_SELF =
eregi_replace("(/.*)*/php.exe/(.*)", "/\\2",
$_SERVER['PHP_SELF']);
>
>
983,992d997
< // Adjust $PHP_SELF for Win32 systems with PHP as CGI
installed
<
//=====================================================================================================================
<
< if ($tmp = getenv('SCRIPT_NAME'))
< $PHP_SELF = eregi_replace($tmp . "(/.*)",
"\\1", $PHP_SELF);
< else
< $PHP_SELF =
eregi_replace("(/.*)*/php.exe/(.*)", "/\\2", $PHP_SELF);
<
<
<
//=====================================================================================================================

Discussion


Log in to post a comment.