Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: Problem - Fatal error  (Read 9486 times)

0 Members and 1 Guest are viewing this topic.

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Problem - Fatal error
« on: June 06, 2006, 03:43:19 am »

Hey guys, I upgraded from 1.33, but I got this error when I access my index page (http://photos.flaming-pie.net):

Fatal error: Call to undefined function: db_query() in /home/flaming/public_html/photos/include/init.inc.php on line 248

On the update.php page, this appears at the bottom:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/flaming/public_html/photos/update.php on line 47

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/flaming/public_html/photos/update.php on line 50

And when I version check, I get the same fatal error. Anyone have any ideas as to what I should do?? Thanks!
« Last Edit: June 06, 2006, 09:31:58 pm by Nibbler »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #1 on: June 06, 2006, 03:54:44 am »

If you have properly upgraded, you wouldn't get this error.

The function db_query() is *only* used on 1.3.x.  The new function is cpg_db_query().  No, don't go through and replace the function manually.  This just means that you haven't properly upgraded your site so it uses all the new scripts from 1.4.6.

Please read the docs (linked above or in your 1.4.6 package) about upgrading and follow the instructions carefully.  Somehow, you didn't copy the scripts correctly.  But don't just blindly copy them, because there are a few files you need to make sure *not* to replace.  The doc tells all.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #2 on: June 06, 2006, 04:08:55 am »

I honestly think that it might not have anything to do with the upgrade. Since the file (init.php) wasn't included in the files to replace.

I'm not sure what would have happened in the upgrade.. I followed everything to the letter. I'll go back and re-check though.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #3 on: June 06, 2006, 04:34:33 am »

I think you don't understand the upgrade process.

You replace nearly *all* the files. 

The 5th step in the upgrade process:
Quote
Except for the "albums" directory, upload all of the new files and directories making sure not to overwrite the include/config.inc.php file, your anycontent.php file or the albums directory.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #4 on: June 06, 2006, 04:38:05 am »

I understand that. I followed that step perfectly. In fact, I followed everything extremely carefully, so I do not understand exactly what went wrong.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #5 on: June 06, 2006, 04:46:46 am »

Ok, but one of the files to replace was include/init.inc.php, which is the one that gave the error message in your first post.  So that file was *not* replaced.

Maybe your FTP client is set to "ignore" instead of "overwrite" when a file already exists on the server.  Check your settings.  I usually set my client to "Ask" so I know when it finds identical files and I can overwrite by choice.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #6 on: June 06, 2006, 04:51:05 am »

Really?? I didn't get the init.inc.php file in with the files to upgrade with. Was it missing? Should I download the files again?

(PS - Thanks for all of your help.. I really appreciate it.)
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #7 on: June 06, 2006, 04:56:22 am »

Where did you get the files? 

You download the complete package from the Downloads link at the top of this page.  It's the regular package, the same you would use if you are installing Coppermine for the very first time.

The upgrade instructions in the docs (linked above as well or in your package) tells you how to use this package to perform an upgrade.

Make sure your unzip program uses the paths in the zip.  Once you unzip the package, you'll have a number of folders, including the "include" folder which has init.inc.php in it.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #8 on: June 06, 2006, 04:59:50 am »

Yeah, I did exactly that. Hmm.. I will try to download the files again and see if I get that file in the downloads this time.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #9 on: June 06, 2006, 05:39:03 am »

Okay, I downloaded the files again and overwrote the init.inc.php file, but now it gives me this:

Fatal error: While executing query "SELECT * FROM cpg132_config" on 0

mySQL error: Table 'flaming_photos.cpg132_config' doesn't exist

And I'm still getting the two errors I posted about on the update.php page in my first post. Should I try the upgrade all over again?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #10 on: June 06, 2006, 05:48:41 am »

The two update.php errors are due to the database connection not being made - i.e. they are follow-on errors.  (They are trying to fetch the array expected after the query - the query is not being made, in the first post because of the missing db_query function, and in this last case because of a missing table.)

So the only problem you have right now is the missing table.

Are you sure your include/config.inc.php has the correct database information?
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #11 on: June 06, 2006, 06:01:22 am »

The database info is all correct. The only thing I think could be wrong (depending on the script) would be the table prefix which looks like:

// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                'cpg132_';
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #12 on: June 06, 2006, 06:06:44 am »

Your database tables are used in the new version, with the table prefix being the same as it was in your previous version.  So 'cpg132_' as your table prefix in newer versions is perfectly fine.  There's no reason to change the prefix.

If your previous Coppermine (1.3.3) was working, the same config.inc.php should work in 1.4.6.

If you're sure config.inc.php is correct, I guess I would try accessing your database using a tool like phpMyAdmin to double-check the connection username and password and the database name and the table prefix.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #13 on: June 06, 2006, 06:13:14 am »

It all looks normal. However, my site was hacked today, and they replaced the config.inc.php file with the hacking code, so I used the sample file to create a new config page. So this is what I have now:

<?php
// Coppermine configuration file

// MySQL configuration
$CONFIG['dbserver'] =                         'localhost';        // Your databaseserver
$CONFIG['dbuser'] =                         '';        // Your mysql username
$CONFIG['dbpass'] =                         '';                // Your mysql password
$CONFIG['dbname'] =                         '';        // Your mysql database name


// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                'cpg132_';
?>

(With all of the proper sections filled out of course.) Is this correct?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #14 on: June 06, 2006, 06:16:11 am »

Yes, that looks correct.  Are you sure your prefix is 'cpg132_' and not 'cpg133_' since you mentioned your previous version was 1.3.3?

I guess it's time to check your database directly using phpMyAdmin.
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #15 on: June 06, 2006, 06:18:56 am »

Yeah, I actually had just done that before I posted the last time. It's 132. :/
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #16 on: June 06, 2006, 06:20:20 am »

Wait a second.  I didn't see the link to your site in the first post until now. 

Something is strange.  Your update.php script does say it is doing all the updates fine.  But then when it tries a "SELECT" query, that's when it chokes.

When your site was hacked, did you change your db username and password?

Maybe the new username and password does not have SELECT privileges?
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #17 on: June 06, 2006, 06:23:25 am »

I just made sure that my current name and password did have that privilege. Should I maybe create a new name and password and try it that way?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Problem - Fatal error
« Reply #18 on: June 06, 2006, 06:38:17 am »

Actually, I take that back.  Your update.php script does not actually check your config table.  The "Already Done" messages for the cpg132_config queries just means that the queries failed - it doesn't mean the table actually exists. 

So maybe your config table is gone.  Looking at the update.php list, maybe all your tables are gone.  The db connection must be OK because it's able to create the cpg132_filetypes and _sessions tables (the only tables with "OK" messages which means the queries succeeded).

Are your tables present in the flaming_photos database (and correctly named)?
Logged

flamingpie

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Re: Problem - Fatal error
« Reply #19 on: June 06, 2006, 08:35:17 pm »

These are the tables listed in my database:

flaming_photos 

  cpg132_banned
  cpg132_bridge
  cpg132_dict
  cpg132_ecards
  cpg132_exif
  cpg132_favpics
  cpg132_filetypes
  cpg132_hit_stats
  cpg132_plugins
  cpg132_sessions
  cpg132_temp_data
  cpg132_vote_stats
  cpg133_albums
  cpg133_banned
  cpg133_categories
  cpg133_comments
  cpg133_config
  cpg133_ecards
  cpg133_exif
  cpg133_filetypes
  cpg133_pictures
  cpg133_temp_data
  cpg133_usergroups
  cpg133_users
  cpg133_votes

So I guess I do have a mixture of 132 and 133 that I didn't notice before!
Logged
Pages: [1] 2   Go Up
 

Page created in 0.026 seconds with 19 queries.