|Forums Integrator||>||All threads||>||Problems with paths and db.php||>||(Un) Subscribe thread alerts|
iworld admin - 2006-08-08 00:35:54
This could be a really great class, many people are obviously trying to integrate with phpBB and there seem to be few options. Unfortunately many of us are not great programmers. I have lots of php scripts and have dopne lots of hacks to get them customized, but I'm not a programmer. I don't like programming. I just want to get something done.
So I tried this class and this is where I'm at:
I added the file as it is to my directory with login and user management scripts. Called phpbb.php
I log the user into my system then called the class this way:
$x= new phpbb('patch/to/phpbb/');
The first thing I found is that in php 4 the "public" needs to be removed on ALL functions and not just the first. That wasn't really clear.
Then I got an error that it couldn't open config.php due to the path being outside the openbase dir restriction. Which it is not. So I changed the class call to this:
$x= new phpbb('/www/vhosts/csac/phpbb2/');
I'm guessing that maybe 'patch/to/phpbb' means to put the path to the phpBB directory there. If so I'm not sure if that needs to be done within the phpbb.php file also or not.
Still had path problems so in the login function I replaced the three instances of
require_once( $this->patch . "
This explicit path definition seemed to allow it to get a bit further.
However, now I get an error related to the phpBB includes/db.php function:
Warning: main(db/mysql.php): failed to open stream: No such file or directory in /usr/local/apache/vhosts/csac/phpBB2/includes/db.php on line 31
Warning: main(): Failed opening 'db/mysql.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/apache/vhosts/csac/phpBB2/includes/db.php on line 31
Fatal error: Cannot instantiate non-existent class: sql_db in /usr/local/apache/vhosts/csac/phpBB2/includes/db.php on line 60
I'd really like to get this figured out since it would be great to be able to use the whole package, such as registration etc.
It's possible I'm doing something obviously wrong. I'm not certain if I'm using it right or not. It's too bad there are not any examples or any better documentation to work from.
Any idea how to make this work?
I have php 4.something and the latest phpBB (2.0.21)
iworld admin - 2006-08-08 01:51:58 - In reply to message 1 from iworld admin
I went one step further and changed the line in the phpBB db.php file to have an explicit path also and it seems to work now. But it should not be necessary to change any phpBB code and I'm bothered by that.
All the changes to phpbb.php listed above are still there also.
I am also able to make it log me out. But I had to change the paths in the logout function to be explicit as well. They are identical to those in the login so I cut and pasted.
So it can be made to work, but the changes are odd and one is in phpBB code itself.
There seems to be some kind of problem or conflict with the path-to-phpbb variables. The phpbb config has such a variable and this class does also. Something is screwed up in this regard.
Richard Munroe - 2006-08-09 13:21:41 - In reply to message 2 from iworld admin
The problem is that with PHP 5, the __construct function is called when you use new to make an instance of the class. In PHP 4, the function called by new to initialize the class is the same as that of the class. Since there is no constructor function called in PHP 4 for this class, the patch class variable is left uninitialized, thus the failures of the require_once statements.