Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: 1.5 Error connecting to Database  (Read 7838 times)

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
1.5 Error connecting to Database
« on: August 14, 2008, 12:33:24 AM »

It's been A LONG while since I've used sNews.  I've been away from a computer for quite a long time, just got a new one & internet.  I installed sNews 1.6 today.  Got a database error message.  Uninstalled all that and tried 1.5 then.  I still keep getting the old
Quote
There was an error while connecting to the database.
Check your database settings.
message.

I used the ReadMe file and did what it said...I even looked at http://www.snews.ca/installs/create-database/ to make sure I did it right.

What could the problem possibly be?  What's the deal with the "prefix" - is that something I need to do?
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: 1.5 Error connecting to Database
« Reply #1 on: August 14, 2008, 01:13:43 AM »

It's been A LONG while since I've used sNews.
What could the problem possibly be?  What's the deal with the "prefix" - is that something I need to do?

Welcome back Gypsy.
As you might remember... sNews is pretty easy to get up and running... provided the right ingredients are at hand.
I would stick with using the current 1.6 package though. There are (usually only a few possible problems.

The "prefix" variable only needs a value in it if you have added a prefix to the table-names in your tables when you used phpMyAdmin to add your tables to your new dbase. As an example, let's say you added gypsy_ to the front of the table-names... like gypsy_articles (and so on)... then you would put gypsy_ in between the quote marks for the value. This just adds it to all the default table-names in all the queries throughout the snews.php file. Otherwise... leave it empty (as-is).

1 -  First thing to check... as always...the values you have in the $db configuration variables at the top of snews.php.
      Be sure you have the forward slash at the end of your URL path.
      If they are all correct, you should have a database connection. Post yours here if you aren't sure so we can have a look-see.

2 - While you are at it... are you sure your host server has Apache's mod_rewrite module enabled?
     If you aren't sure, open a new PHP file in your good Code Editor and paste <?php phpinfo(); ?> in it.
     Save it as phpinfo.php. Upload it to the domain root. Call it into action with http://www.your-domain.com/phpinfo/
     This will show you your server's information. In the PHP section, look in the installed modules block to see if moad_rewrite is listed.
     If it isn't, then you'll need to request your host have it enabled.

Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Joost

  • Guest
Re: 1.5 Error connecting to Database
« Reply #2 on: August 14, 2008, 01:29:55 AM »

This message is shown if something is wrong (a typo for instance) with one of the following:

   $db['dbhost'] = 'localhost'; //MySQL Host
   $db['dbname'] = 'snews'; //Database Name
   $db['dbuname'] = 'gypsy'; //Database Username
   $db['dbpass'] = 'Clooney'; //Database password

prefix should only be changed if you actually prefix the table names. Like
 dull_articles
 dull_categories

Then you need to change the prefix to 'dull_'.


Logged

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #3 on: August 14, 2008, 02:10:24 AM »

First the Apache's mod_rewrite module is enabled.  See:  http://RaisedByTheMusic.com/phpinfo.php

This is the only section that I edited:

Code: [Select]
        $db['website'] = 'http://raisedbythemusic.com/';
$db['dbhost'] = 'localhost'; //MySQL Host
$db['dbname'] = 'site'; //Database Name
$db['dbuname'] = 'Gypsy'; //Database Username
$db['dbpass'] = 'xxxxx'; //Database password
$db['prefix'] = ''; //Database prefix

Changed the domain, Database name (instead of snews, I used site -- Does that make a difference?), my user name and password.  And I did check to make sure the password was what I used to begin with.

Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Joost

  • Guest
Re: 1.5 Error connecting to Database
« Reply #4 on: August 14, 2008, 02:25:45 AM »

No, the name are what you chose. If you have created a database named 'site', that's ok.
This issue is not mod_rewrite or prefix related, so forget that.
Find out if the database server is really located at the same server. If not, 'dbhost' will not be localhost but an address (url) provided by the hosting company. username and password are the once you've also used when creating the database tables.
Logged

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #5 on: August 14, 2008, 02:32:38 AM »

I'm going to uninstall it all and start over.  I'll install 1.6 this time and see where it leads me.
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #6 on: August 14, 2008, 03:02:09 AM »

still having issues.  I'm almost at wits end to give up for the night and try in the morning.  I don't know why I'm having such problems now.  It's the same host as I had before and never had problems getting it to work before.  If anyone has any suggestions please post...I'll check back in just a little bit.  Need to take a break before I get upset, blah!

Or if I need to post a certain portion of my code for you to help figure it out, let me know what I need to post.  Thanks!
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: 1.5 Error connecting to Database
« Reply #7 on: August 14, 2008, 03:31:00 AM »

Or if I need to post a certain portion of my code for you to help figure it out, let me know what I need to post.  Thanks!

Take the rest of the evening off and enjoy time with your kids. We can sort it out tomorrow.
This is a single issue... getting a connection to your database.
If need be, we can work on it by PM.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: 1.5 Error connecting to Database
« Reply #8 on: August 14, 2008, 03:39:25 AM »

QUESTION... what file-set is on your server at this moment?
The error messages I get say the errors are on lines 229 and 230 in your snews.php file.
I looked in virgin files for 1.5.31 and 1.6 and these lines numbers are in the langauge variables array.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #9 on: August 14, 2008, 03:43:26 AM »

Thanks for trying to help Keyrocks, I really appreciate it.  Kiddies are off to bed  ;D  It's almost 10pm here.  But I'm usually up til about 2am (I nap mid-day with the kiddies - I know, LUCKY). 

I actually found an old version 1.4 still in use on an old site of mine.  Tried to see if it would work with the changes to user/pw/domain/db name...but I couldn't figure it out either.  So I really need to redo all.
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: 1.5 Error connecting to Database
« Reply #10 on: August 14, 2008, 04:02:14 AM »

Thanks for trying to help Keyrocks, I really appreciate it.  Kiddies are off to bed  ;D  It's almost 10pm here.  But I'm usually up til about 2am (I nap mid-day with the kiddies - I know, LUCKY). 

I actually found an old version 1.4 still in use on an old site of mine. 

OK... that explains it... right in the heart of the // PERMANENT CONNECTION TO THE DATABASE function - connect_to_db()
So... the problem is with the value in one or more of these strings... we just need to get these matched up with what you used/created when you created and populated your database in phpMyAdmin.
$s['dbhost'] = "localhost"; // MySQL host
$s['dbname'] = "name-of-your-database"; // Database name
$s['dbuname'] = "your-dbase-username"; // Database Username
$s['dbpass'] = "your-dbase-username-password"; // Database password

On some servers... (all of mine with one ISP) the username you use to login to your CPanel needs to be added to the dbname and dbuname values for it to connect.
Example... if your CPanel login  username is hombre then your dbname should be hombre_site and your dbuname would be hombre_Gypsy ... or hombre_gypsy if you used lower-case "g".

ADDED NOTE - Can you go back into your CPanel and check to see what your dbname and dbuname are in there?
« Last Edit: August 14, 2008, 04:04:19 AM by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #11 on: August 14, 2008, 04:41:00 AM »

Just to make sure I understand my information is as follows.
  • Database name: snews
  • Database username: gypsy
  • Login to Cpanel: music

So I should try to use the following then?

Code: [Select]
$s['dbhost'] = "localhost"; // MySQL host
$s['dbname'] = "music_snews"; // Database name
$s['dbuname'] = "music_gypsy"; // Database Username
$s['dbpass'] = "xxxx"; // Database password
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #12 on: August 14, 2008, 04:43:23 AM »

ADDED NOTE - Can you go back into your CPanel and check to see what your dbname and dbuname are in there?

Current Databases:  music_snews

Current Users:  music_gypsy
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: 1.5 Error connecting to Database
« Reply #13 on: August 14, 2008, 02:12:31 PM »


Current Databases:  music_snews
Current Users:  music_gypsy

@ Gypsy... I notice a complete template showing on your domain this morning so I assume you got the dbase connection issue sorted out. Judging from the above, your CPanel username is automatically being added to your dbase username and dbase name. Did using them as shown make the difference?
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Gypsy

  • Full Member
  • ***
  • Karma: 2
  • Posts: 195
    • Designs By Gypsy
Re: 1.5 Error connecting to Database
« Reply #14 on: August 14, 2008, 10:27:27 PM »

Actually no, that is just hand coded....it's not sNews or another cms.  It's a temporary page with the basic information I needed up.

I'm setting up subfolder titled "snews" now so I can try to figure out the problem.  I tried using the following and it still didn't work.

Code: [Select]
$s['dbhost'] = "localhost"; // MySQL host
$s['dbname'] = "music_snews"; // Database name
$s['dbuname'] = "music_gypsy"; // Database Username
$s['dbpass'] = "xxxx"; // Database password

Also, here's another question related to this site - but not to this version of snews, necessarily.  I have wordpress theme set up at a different site http://KYscene.com and I would rather it not be wordpress really.  I'd like to use a theme similar to that for both sites I'm working on.  Is there a way for snews to do the same thing as that theme?  It calls one or two of the last posts from 5 different categories to be placed on the front page so it looks more like a magazine.  If this is able to be done, I'll definitely stick to sNews.  If not, I have to find or create something with the same mag/newspaper style feel to it.
« Last Edit: August 14, 2008, 10:30:07 PM by Gypsy »
Logged
Gypsy Gyp新y (jip'se)
Vagrant, A Wanderer, faery,
One who lives a carefree life
One inclined to a unconventional way of life.