forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 upgrading => Topic started by: flamingpie 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 (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!
-
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.
-
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.
-
I think you don't understand the upgrade process.
You replace nearly *all* the files.
The 5th step in the upgrade process:
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.
-
I understand that. I followed that step perfectly. In fact, I followed everything extremely carefully, so I do not understand exactly what went wrong.
-
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.
-
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.)
-
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.
-
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.
-
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?
-
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?
-
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_';
-
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.
-
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?
-
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.
-
Yeah, I actually had just done that before I posted the last time. It's 132. :/
-
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?
-
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?
-
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)?
-
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!
-
$CONFIG['TABLE_PREFIX'] = 'cpg132_';
Set that to 133 and run update.php
-
YAY! It worked :D Thanks so much for all of your help, Paver and Nibbler.