81
korafa
Re: Database problem
  • 2009/5/25 1:48

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


I am having the same issue trying to install XOOPS 2.3.3

Each time I get to Database connection I either get "cannot connect to the database', or it just reloads the same page with no error (but no success either)

I have:

MySQL Version
5.0.45

PHP Version
5.2.5

I've submitted a ticket with my host provider to have them try and figure it out for me too. If I hear anything useful from them, I will post it here.

82
korafa
Re: Database problem
  • 2009/5/25 23:53

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


well my provider said they can connect to the database no problem, but I still can't. I've tried another provider and get the same error (although they both use MySQL Beta)

Question: I do notice that the Database dropdown only contains the 'mysql' option. Is that the only choice that is supposed to be there, or should I see my database in the drop down?

83
iHackCode
Re: Database problem

what are you creating the databases with (cPanel, Plesk, Helm, Other)?
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

84
korafa
Re: Database problem
  • 2009/5/26 3:35

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


MySql, through FatCow webhosting

PHP Version
5.2.5

MySQL Version: 5.0.45


85
korafa
Re: Database problem
  • 2009/5/26 4:05

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


OK I just got a response from one of my provider's higher level technicians.

Here is what he said to me (I changed my DB name, username, etc.):

Quote:
There is some error in the database connection script. You need to manually edit the database connection script. I have uploaded a test script ‘dbtest.php’ under the folder ‘family’ and I was able to connect to database using Server hostname as ‘MY SQL SERVER’ at URL link: MY URL . Please check the test script ‘dbtest.php’ and edit the script ‘page_dbconnection.php’.


This is what dbtest.php contains:

<?php
mysql_connect("MY SQL SERVER", "USERNAME", "PASSWORD") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("family") or die(mysql_error());
echo "Connected to Database";
?>

He is telling me I need to take that code, or that info and manually change the page_dbconnection.php file. I did test his dbtest.php and it worked: I was able to connect to my database. But being a noob, I can't figure out where to insert it, or change the page_dbconnection.php file.

Any help would be immensely appreciated!

This is the page_dbconnection.php file contents. Where would I insert that info???

<?php
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* Installer database configuration page
*
* See the enclosed file license.txt for licensing information.
* If you did not receive this file, get it athttp://www.fsf.org/copyleft/gpl.html
*
* @copyright The XOOPS projecthttps://xoops.org/
* @licensehttp://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL)
* @package installer
* @since 2.3.0
* @author Haruki Setoyama <haruki@planewave.org>
* @author Kazumi Ono <webmaster@myweb.ne.jp>
* @author Skalpa Keo <skalpa@xoops.org>
* @author Taiwen Jiang <phppp@users.sourceforge.net>
* @author DuGris (aka L. JEN) <dugris@frxoops.org>
* @version $Id: page_dbconnection.php 2822 2009-02-20 08:50:48Z phppp $
**/

require_once './include/common.inc.php';
if ( !defined('XOOPS_INSTALL') ) { die('XOOPS Installation wizard die'); }

$pageHasForm = true;
$pageHasHelp = true;

$vars =& $_SESSION['settings'];

if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
$params = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_PASS' );
foreach ( $params as $name ) {
$vars[$name] = $_POST[$name];
}
$vars['DB_PCONNECT'] = @$_POST['DB_PCONNECT'] ? 1 : 0;
}

$error = '';
if ( $_SERVER['REQUEST_METHOD'] == 'POST' && !empty( $vars['DB_HOST'] ) && !empty( $vars['DB_USER'] ) ) {
$func_connect = empty( $vars['DB_PCONNECT'] ) ? "mysql_connect" : "mysql_pconnect";
if ( ! ( $link = @$func_connect( $vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true ) ) ) {
$error = ERR_NO_DBCONNECTION;
}
if ( empty( $error ) ) {
$wizard->redirectToPage( '+1' );
exit();
}
}

if ( @empty( $vars['DB_HOST'] ) ) {
// Fill with default values
$vars = array_merge( $vars,
array('DB_TYPE' => 'mysql',
'DB_HOST' => 'localhost',
'DB_USER' => '',
'DB_PASS' => '',
'DB_PCONNECT' => 0,
)
);
}
ob_start();
?>
<?php if ( !empty( $error ) ) echo '<div class="x2-note errorMsg">' . $error . "</div>\n"; ?>
<fieldset>
<legend><?php echo LEGEND_CONNECTION; ?></legend>
<label for="DB_DATABASE_LABEL" class="center">
<?php echo DB_DATABASE_LABEL ; ?>
<select size="1" name="DB_TYPE">
<?php
foreach ($wizard->configs['db_types'] as $db_type) {
$selected = ($vars['DB_TYPE'] == $db_type) ? 'selected' : '';
echo "<option value='$db_type' selected='$selected'>$db_type</option>";
}
?>
</select>
</label>
<?php echo xoFormField( 'DB_HOST', $vars['DB_HOST'], DB_HOST_LABEL, DB_HOST_HELP ); ?>
<?php echo xoFormField( 'DB_USER', $vars['DB_USER'], DB_USER_LABEL, DB_USER_HELP ); ?>
<?php echo xoPassField( 'DB_PASS', $vars['DB_PASS'], DB_PASS_LABEL, DB_PASS_HELP ); ?>

<label for="DB_PCONNECT" class="center">
<?php echo DB_PCONNECT_LABEL; ?>
<input class="checkbox" type="checkbox" name="DB_PCONNECT" value="1" <?php echo $vars['DB_PCONNECT'] ? "'checked'" : ""; ?>/>
<div class="xoform-help"><?php echo DB_PCONNECT_HELP; ?></div>
</label>
</fieldset>

<?php
$content = ob_get_contents();
ob_end_clean();
include './include/install_tpl.php';
?>

86
ghia
Re: Database problem
  • 2009/5/26 13:40

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
This is what dbtest.php contains:

<?php
mysql_connect("MY SQL SERVER", "USERNAME", "PASSWORD") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("family") or die(mysql_error());
echo "Connected to Database";
?>
You have to use the values from this example file to fill in the installation screens or you can adapt your mainfile.php with it.
In screen database connection:
Database: MySQL
Server hostname: MY SQL SERVER
User name: USERNAME
Password: PASSWORD
In screen database configuration:
Database name: family
Table prefix: as proposed
charset and collation as your db is
In mainfile.php this will become:
// Database
    // Choose the database to be used
    
define'XOOPS_DB_TYPE''mysql' );

    
// Set the database charset if applicable
    
if (defined("XOOPS_DB_CHARSET")) die();
    
define'XOOPS_DB_CHARSET''utf8' );

    
// Table Prefix
    // This prefix will be added to all new tables created to avoid name conflict in the database. If you are unsure, just use the default "xoops".
    
define'XOOPS_DB_PREFIX''x1234' );

    
// Database Hostname
    // Hostname of the database server. If you are unsure, "localhost" works in most cases.
    
define'XOOPS_DB_HOST''MY SQL SERVER' );

    
// Database Username
    // Your database user account on the host
    
define'XOOPS_DB_USER''USERNAME' );

    
// Database Password
    // Password for your database user account
    
define'XOOPS_DB_PASS''PASSWORD' );

    
// Database Name
    // The name of database on the host. The installer will attempt to create the database if not exist
    
define'XOOPS_DB_NAME''family' );
Of course MY SQL SERVER, USERNAME, PASSWORD, family have to be substituted.

87
korafa
Re: Database problem
  • 2009/5/26 14:33

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


OK, I am at a loss. I understand what you are saying, but do not understand exactly where to make those changes. The mainfile.php is blank at the moment, since I am still trying to install.

In the db_connection step of the install process, everytime I enter the data into the provided fields, It get the Cannot Connect to the Database error. I've tried to edit the file, but don't have a good enough grasp of the programming language to really understand where I need to make the changes.

I tried inputting the data into this area:

if ( @empty( $vars['DB_HOST'] ) ) {
// Fill with default values
$vars = array_merge( $vars,
array('DB_TYPE' => 'mysql',
'DB_HOST' => 'MYSQLSERVER',
'DB_USER' => 'USERNAME',
'DB_PASS' => 'PASSWORD',
'DB_PCONNECT' => 0,

but that didn't work and those, to me, just tell me what the default values are. Either way I still got the error.

please forgive my stupidity, I really want to learn

88
ghia
Re: Database problem
  • 2009/5/26 15:16

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Was use persistent connections unchecked?
Else try once with modifying this line
if ( ! ( $link = @$func_connect$vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true ) ) ) {
to
if ( ! ( $link = @$func_connect$vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], false ) ) ) {

89
korafa
Re: Database problem
  • 2009/5/26 15:33

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


yes persistent connections was unchecked. I also tried substituting that new snippet of code and it did not work :(



90
korafa
Re: Database problem
  • 2009/5/27 3:46

  • korafa

  • Just popping in

  • Posts: 16

  • Since: 2008/8/12


OK, here's a little more information.

I successfully installed XOOPS 2.0.18.1 with zero issues; it connected to my database just fine. One thing I noticed in this install is that it asked me for the database name, whereas the XOOPS 2.3.3 installer did not (mysql was the only option).

Hopefully this helps

Login

Who's Online

304 user(s) are online (192 user(s) are browsing Support Forums)


Members: 0


Guests: 304


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits