HELP Error when trying to create users in Phorum from main system

Posted by KWood 
HELP Error when trying to create users in Phorum from main system
November 02, 2008 08:23AM
I am trying to create users in Phorum when they are created i the main system..
I have used the you made in another tread but get an error:
the code (with a change in sitename):
$curcwd = getcwd();
chdir("/hsphere/local/home/siteYY/siteXX/medlemv2/phorum");
define('phorum_page','create_user');

include("./common.php");
echo "Opret medlem";
/*phorum_api_user_save(array(
"user_id" => $idb, // or the user id from your main user database
"username" => $brugernavn,
"real_name" => $brugernavn,
"password" => $passencrypt,
"active" => $PH_status,
"hide_email"=> "TRUE",
"email" => $email1
));*/
chdir($curcwd);
the error:

Opret medlem Fatal error: main(): Failed opening required './include/db/.php' (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/siteYY/siteXX/medlemv2/phorum/common.php on line 146

Its seems like it includes the common.php correctly but fails the create the variabels for the database (running the script under /phorum directly without using the chdir works fine...
HELP :-)
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 09:08AM
I don't see what's going wrong for you. What seems to be missing, are the variables from include/db/config.php. Maybe $PHORUM is out of scope or so (although that shouldn't happen IMO). You could try adding this to the start of your code:
[code="php"]
global $PHORUM;
[/code]

Something to start with for debugging is checking if include/db/config.php is loaded when you start your script.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 09:36AM
Hi Tried to include the line you gave, it did not work... config.php is loaded (tested by adding a extra varialbel and it came through perfectly...)....

I am really at lost here... any other ideas?
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 09:55AM
Based on the error, $PHORUM['DBCONFIG'] or at least $PHORUM['DBCONFIG']['type'] is empty. So try to track if that is setup correctly from include/db/config.php and track if it is still available when common.php tries to load the db layer code at line 146.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:01AM
This is pretty wierd... as for testing I change line 146 to:

require_once( "./include/db/{$PHORUM['DBCONFIG']['type']}.php".test );

which gives the following error:
Fatal error: main(): Failed opening required './include/db/mysql.phptest' (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/madam/madammangor.dk/medlemv2/phorum/common.php on line 146

So because I added some tekst at the end, suddently the $PHORUM has value...

it still only the adin that fails,,,
Phorum is working fine on it self...

I Am really lost...
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:24AM
Hi again
The $PHORUM variable is passed trough... changing line 146 to this:

require_once( "./include/db/{$PHORUM['DBCONFIG']['type']}.php".$PHORUM['DBCONFIG']['type'] );

gives the output:

Fatal error: main(): Failed opening required './include/db/mysql.phpmysql' (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/madam/madammangor.dk/medlemv2/phorum/common.php on line 146

I just dont get it...
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:29AM
The weird continues:

changing line 146 to:
require_once("./include/db/{$PHORUM['DBCONFIG']['type']}.php".p );

gives:
Fatal error: main(): Failed opening required './include/db/mysql.phpp' (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/madam/madammangor.dk/medlemv2/phorum/common.php on line 146

but

require_once("./include/db/{$PHORUM['DBCONFIG']['type']}.ph".p );

gives:

Opret medlem Fatal error: main(): Failed opening required './include/db/.php' (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/madam/madammangor.dk/medlemv2/phorum/common.php on line 146


I just dont get this...
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:39AM
the first line is from the include in common.php the second one is later after your print command.
you should check later in the script, the parts we aren't seeing there, what you are doing. I also recommend to change the common.php include to include_once.


Thomas Seifert
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:46AM
Hi Thomas
I dont get what you mean... (my bad :-))
they are both examples of the same line in common.php (line 146)
I dont have a Print command any where?
Re: HELP Error when trying to create users in Phorum from main system
November 02, 2008 10:48AM
sure from common.php but from different includes.
The first error message is with a wrong change on the first include.
The second error message is after your echo
[code="php"]
echo "Opret medlem";
[/code]

so you are including common.php twice. somewhere lower in your code.


Thomas Seifert
Sorry, only registered users may post in this forum.

Click here to login