phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev


 
Search this topic... | Search Knowledge Base (KB)... | Search Box
Register or Login to Post    Index » Knowledge Base (KB)  Previous TopicPrint TopicNext Topic
Author Message
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Thu Jan 15, 2009 6:27 pm 
Post subject: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev
Written by Dog Cow on the evening of 13 Jan 2009.

All right, so you're not sure if phpBB 2.0.23 will run on PHP 6 and you want to make it ready? Well, the good news is, it can. So follow along. Actually, as it turns out, phpBB 2.0.23 is even easier to get running on PHP 6 than phpBB 3.0.4 is! In fact, get this: phpBB 1.4.4 will even run on PHP 6 with just _one_ change to a file. Also, a lot of popular scripts don't work on PHP 6 and need more changes than phpBB 2 does: Wordpress, IPB, CodeIgniter, Coppermine Photo Gallery, cakePHP, phpMyAdmin... just to name a few I have tested.

After you've made these 3 changes, your phpBB 2.0.23 forum should be working perfectly. Now, I can't say the same for any MODs you may have installed... though these same 3 fixes are what I used for my site, and I've got a _lot_ more code running beyond phpBB, but all of
it is coded to PHP 5 standards and so makes the transition flawlessly. Your mileage may vary.

1.) As soon as you load any phpBB 2.0.23 page, you'll get a white screen. Or, if display_errors is On, you'll get this:

Fatal error: Call to undefined function set_magic_quotes_runtime() in /Library/WebServer/Documents/phpbb2023/common.php on line 29

The reason: magic quotes no longer exists in PHP 6. So, open the common.php file.

And change this:
set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

To this:
//set_magic_quotes_runtime(0); // Disable magic_quotes_runtime

Basically, you are just commenting-out that line.

2.) Now, if you reload the index page .... tada! It works! Although, you might see some Errors or Warnings displayed at the top of the page.

Here's one similar to what you might have gotten:

Warning: urlencode() expects parameter 1 to be strictly a binary string, Unicode string given in /Library/WebServer/Documents/phpbb2023/memberlist.php on line 231

The reason: Unicode.semantics has been set to On. When on, all strings in PHP are treated as Unicode. The problem? phpBB 2 wasn't written with that in mind.

Here is the solution:

Open the php.ini file (Mine is located at: /usr/local/php6/lib/php.ini)

And change this:
unicode.semantics = on

To this:
unicode.semantics = off

3.) Now, unless you've got MODs installed which are either very old or aren't coded to strict PHP standards, your entire phpBB forum should work as usual! Click around and see. But if you try to log in, you'll come up with a problem!

The reason: I don't really know, actually! It has to do with the cookies not being sent properly to the browser. But I've got a solution.

Open includes/sessions.php

Change this:
session_clean($userdata['session_id']);

setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);

setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);

To this:
session_clean($userdata['session_id']);

setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);

Then, change this:
setcookie($cookiename . '_data', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);

To this:
setcookie($cookiename . '_sid', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_data', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);

And finally, change this:
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);

To this:
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);

What you are doing here is making the SID cookie be sent first. There seems to be some problem with the setcookie function. This is probably related to the developmental nature of PHP 6.
Back to top
~Cowboy~
Board Member



Joined: 08 Dec 2008

Posts: 297
Location: Chicago


flag
PostPosted: Thu Jan 15, 2009 10:19 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Nice Work Dog Cow Image link

Now I'm only worried about phpMyAdmin icon_lol.gif
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Fri Jan 16, 2009 6:18 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

~Cowboy~ wrote:

Now I'm only worried about phpMyAdmin icon_lol.gif

I have a slightly out-of-date version (well, I don't know exactly how out of date it is...) which worked rather strangely, I will say. I should get a newer version and see how it goes.
Back to top
suitlocal
Board Member



Joined: 18 Jan 2009

Posts: 2



PostPosted: Sun Jan 18, 2009 7:06 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Dog Cow wrote:
1.) As soon as you load any phpBB 2.0.23 page, you'll get a white screen. Or, if display_errors is On, you'll get this:

Fatal error: Call to undefined function set_magic_quotes_runtime() in /Library/WebServer/Documents/phpbb2023/common.php on line 29

The reason: magic quotes no longer exists in PHP 6. So, open the common.php file.

stupid php development team - they could have just implemented that function and made it give a E_NOTICE saying magic quotes is no more. but nooooo - they delete it all together, guaranteeing that applications will break.

i am all for breaking backwards compatability if you get something out of it but you do not get anything out of this.
Back to top
~Cowboy~
Board Member



Joined: 08 Dec 2008

Posts: 297
Location: Chicago


flag
PostPosted: Sun Jan 18, 2009 5:33 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

I agree, everything should be backwards compatible.. But then I don't know the reason for leaving it out of PHP 6 though. icon_confused.gif

Perhaps they had a good reason. A security matter perhaps?

I would like to know the answer to that one.
Back to top
Ptirhiik
Board Member



Joined: 19 Nov 2008

Posts: 114


flag
PostPosted: Sun Jan 18, 2009 7:21 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

It is very difficult to ensure there a backward compatibility, as silent error may hide deep problems. Getting the problem pop is probably the better way to be sure it will be noticed at least. However, php6 is still in development, so we have to wait for the final.
Back to top
Sylver Cheetah 53
Board Member



Joined: 17 Dec 2008

Posts: 426
Location: Milky Way


flag
PostPosted: Mon Jan 19, 2009 8:54 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Thanks for the effort, Dog Cow! Unfortunatelly, it seems very hard to implement. icon_sad.gif
Is this the final version of PHP6? What is "dev"?
Back to top
~Cowboy~
Board Member



Joined: 08 Dec 2008

Posts: 297
Location: Chicago


flag
PostPosted: Tue Jan 20, 2009 12:55 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Sylver Cheetah 53 wrote:
What is "dev"?
Dev = Development
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 309
Location: U.S.A


flag
PostPosted: Thu Jun 24, 2010 9:46 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

What would you say the reasons would be for choosing to go with PHP6?

Thanks
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Fri Jun 25, 2010 2:13 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Not so much a choice as "If your host upgrades to it your phpBB board is f***ed"
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 309
Location: U.S.A


flag
PostPosted: Fri Jun 25, 2010 2:34 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Acaria wrote:
Not so much a choice as "If your host upgrades to it your phpBB board is f***ed"


Oh, thought there might be some more "pressing" issue to want to choose to upgrade PHP versions.

If that is it, then no worries.
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Fri Jun 25, 2010 5:18 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Yeah, that's basically the only reason to. If you have your own host and like things the way they are, just never update your PHP. It's not like you're losing anything.
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Tue Jun 29, 2010 2:00 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

PHP 6 has still not been officially released. There is no reason to use it on one's main web site.

However, when PHP 6 is released, it will do away with a lot of old and insecure code and thus will break many scripts. Therefore, advanced users can download the development versions of PHP 6, compile them, and test their code against it.

I have done this for my web site. It never hurts to be prepared.
Back to top
Slackervaara
Board Member



Joined: 01 Jan 2009

Posts: 70



PostPosted: Tue Jun 29, 2010 7:20 am 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

I posted this thread in a PHP-Nuke forum, as it have phpbb2, as a module and I got this reply:

interresting
but what if if we can't access php.ini , how to solve that?
Code:

Warning: urlencode() expects parameter 1 to be strictly a binary string, Unicode string given in /Library/WebServer/Documents/phpbb2023/memberlist.php on line 231
Back to top
Methen
Board Member



Joined: 29 May 2010

Posts: 32



PostPosted: Wed Aug 22, 2012 11:46 pm 
Post subject: Re: Guide: Getting phpBB 2.0.23 to work on PHP 6.0.0-dev

Well has anyone ever bother to write the people who create php and make a polite request that they make it backwards compatible at least with phpbb 2023 the worse they can say is no...
Back to top
Display posts from previous:   
Register or Login to Post    Index » Knowledge Base (KB)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0312 seconds using 15 queries. (SQL 0.0018 Parse 0.0010 Other 0.0285)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo