update old phpbb2 Forum connection to PDO

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
Post Reply
jtrumpfheller
Registered User
Posts: 8
Joined: Mon Mar 06, 2006 1:44 pm
Location: Berlin, DE/EU/Alpha-Q 001
Contact:

update old phpbb2 Forum connection to PDO

Post by jtrumpfheller »

Hello people,

it is a very long time I was here (2006?) but I hope you can help me.

When the switch to phpbb3 happened I decided to stay with my customized version of phpBB 2.0.23 with the Solaris template (you can see it here: https://www.spearhead-home.com/phpBB2/). It is still working fine for me (Using it as an archive) and it is still running with PHP Version 5.6.40 and MySQL 5.7.

Now I want to use the newest version of PHP 7.3.7 and got the problems with the deprecated mysql_connection and depended functions. For my other tables outside phpbb2 I use already the PDO functions.

Is it possible to rewrite the sql_db class to use PDO something like this:

Code: Select all

class sql_db
{
	var $db_connect_id;
	var $query_result;
	var $row = array();
	var $rowset = array();
	var $num_queries = 0;
	var $in_transaction = 0;

	function sql_db($sqlserver, $database, $sqluser, $sqlpassword)
	{
		$this->db_connect_id = 0;

		$this->server = $sqlserver;
		$this->dbname = $database;
		$this->user = $sqluser;
		$this->password = $sqlpassword;

		$this->$options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'); 

		try 
		{
			$this->db_connect_id = new PDO("mysql:host=".$this->server.";dbname=".$this->dbname, $this->user, $this->password, $options);
		} 
		catch (PDOException $e) 
		{
		 	print "Error!: " . $e->getMessage() . "<br/>";
		}
		return $this->db_connect_id;
	}
	
	//...
	//Same changes to 
	
	//mysql_query
	//mysql_num_rows
	//mysql_affected_rows
	//mysql_fetch_array

	//should be made
}
Is there a way?

Thanks Joerg
... any % of U is as good as the whole pie ...
Joerg

****E-Mail: [email protected]
Homepage: https://www.spearhead-home.com

User avatar
david63
Registered User
Posts: 355
Joined: Mon Feb 07, 2005 7:23 am

Re: update old phpbb2 Forum connection to PDO

Post by david63 »

jtrumpfheller wrote: Mon Jul 29, 2019 3:46 pm Now I want to use the newest version of PHP 7.3.7
There are no versions of phpBB that are currently compatible with PHP 7.3 - you will have to wait for the release of phpBB 3.3

Also you would be better asking your support question on the main phpBB board
David
Remember: You only know what you know -
and you do not know what you do not know!

jtrumpfheller
Registered User
Posts: 8
Joined: Mon Mar 06, 2006 1:44 pm
Location: Berlin, DE/EU/Alpha-Q 001
Contact:

Re: update old phpbb2 Forum connection to PDO

Post by jtrumpfheller »

david63 wrote: Mon Jul 29, 2019 8:58 pm There are no versions of phpBB that are currently compatible with PHP 7.3 - you will have to wait for the release of phpBB 3.3

Also you would be better asking your support question on the main phpBB board
The newest version of php isn't the point (maybe this is better: a newer version of php) - how can I change the phpBB2 connection to PDO functionalaties?

Thanks for the main board hint.
... any % of U is as good as the whole pie ...
Joerg

****E-Mail: [email protected]
Homepage: https://www.spearhead-home.com

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 373
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Re: update old phpbb2 Forum connection to PDO

Post by Paul »

phpBB2 is not support since like 2009, the only thing we really can help you with is upgrading it to 3.2. Otherwise you are really on your own.

koraldon
Registered User
Posts: 33
Joined: Thu Mar 10, 2005 12:06 pm

Re: update old phpbb2 Forum connection to PDO

Post by koraldon »

Frankly it will probably be much easier for you to just migrate to phpbb 3.2.

jtrumpfheller
Registered User
Posts: 8
Joined: Mon Mar 06, 2006 1:44 pm
Location: Berlin, DE/EU/Alpha-Q 001
Contact:

Re: update old phpbb2 Forum connection to PDO

Post by jtrumpfheller »

That is no option for me.
As I said it: The Forum is used as a container, where I archive articles ... using html-tags. So what you see on my News-Page is archived in the forum.

https://www.spearhead-home.com/News.php ... ult&t=2517
https://www.spearhead-home.com/phpBB2/v ... php?t=2517
... any % of U is as good as the whole pie ...
Joerg

****E-Mail: [email protected]
Homepage: https://www.spearhead-home.com

warmweer
Registered User
Posts: 121
Joined: Wed Jul 09, 2003 5:27 pm
Location: Belgium

Re: update old phpbb2 Forum connection to PDO

Post by warmweer »

First of all: this is the Development Discussion board, implying that it is not for the current released version.
Secondly: phpBB2 is long past it's support date, as are phpBB3.0.x and phpBB3.1.x.
The current (supported) version is phpBB3.2.x.
And it's been mentioned, there is always support for upgrading to the latest version, but that support can be found on the main site, dedicated to phpBB 3.2.
So there you will be assisted in upgrading to 3.2.
As to your forum, from what I can see you have an almost standard phpBB installation in which the posts are the archive (the second link). The first link is an addon (IIRC there wasn't one like that for phpBB2) which gets the posts from the phpBB database
The way I see it, it's perfectly possible to upgrade to phpBB3.2 and adapt your News.php so that it gets the required info from the phpBB 3.2 database. Perhaps there exist an extension which can do that, or can be modifed to your liking/needs. (have a look at the extension forums on the main site.)
Procrastination is my hobby, but I keep on postponing it.

User avatar
3Di
Registered User
Posts: 951
Joined: Tue Nov 01, 2005 9:50 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Contact:

Re: update old phpbb2 Forum connection to PDO

Post by 3Di »

jtrumpfheller wrote: Mon Jul 29, 2019 3:46 pm When the switch to phpbb3 happened I decided to stay with my customized version of phpBB 2.0.23 with the Solaris template (you can see it here: https://www.spearhead-home.com/phpBB2/). It is still working fine for me (Using it as an archive) and it is still running with PHP Version 5.6.40 and MySQL 5.7.

Now I want to use the newest version of PHP 7.3.7 and got the problems with the deprecated mysql_connection and depended functions. For my other tables outside phpbb2 I use already the PDO functions.
Hi,
I recall of Solaris (the template) it was the first one I used with phpBB 2.0.3 if I correctly recall, long ago. :)

Look, your best bet is to ask here http://phpbb2refugees.com/index.php ;)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades

jtrumpfheller
Registered User
Posts: 8
Joined: Mon Mar 06, 2006 1:44 pm
Location: Berlin, DE/EU/Alpha-Q 001
Contact:

Re: update old phpbb2 Forum connection to PDO

Post by jtrumpfheller »

3Di wrote: Mon Aug 05, 2019 5:24 am ...
Look, your best bet is to ask here http://phpbb2refugees.com/index.php ;)
Thanks, 3Di - I am sure I will find the answer there.
... any % of U is as good as the whole pie ...
Joerg

****E-Mail: [email protected]
Homepage: https://www.spearhead-home.com

Post Reply