News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Upgrade.php unable to connect to the database while everything else can

Started by temeraire02, March 24, 2019, 09:24:30 PM

Previous topic - Next topic

temeraire02

I am trying to upgrade a forum running SMF 2.0 beta 4 to 2.0.15 using the large upgrade. After extracting the files I can see in the forum footer SMF 2.0.15 | SMF © 2017, Simple Machines

and when I click into a thread I get the error
Unknown column 'a.file_hash' in 'field list'
File: /opt/bitnami/apache2/htdocs/Sources/Display.php
Line: 953

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.15, while your database is at version . The above error might possibly go away if you execute the latest version of upgrade.php.


However, when I try to run upgrade.php I only get the error message
Unable to connect to database - please check username and password are correct in Settings.php

This doesn't make sense to me when the forum itself loads and clearly is hitting the db to load everything. It seems upgrade.php uses
$db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, array('non_fatal' => true)); which is very similar to the one in loadDatabase() used by index.php. I have also added debug statements in front of both the smf_db_initiate call in upgrade.php and loadDatabase() and I see the same login details for both. repair_settings.php also shows the correct settings and I am able to connect using mysql to the database with the user configured in settings.php.

What am I missing or doing wrong? Any advice would be welcome. Thanks

GigaWatt

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

temeraire02

PHP Version 5.6.39
System Linux ip-172-26-7-38 4.4.0-1077-aws #87-Ubuntu SMP Wed Mar 6 00:03:05 UTC 2019 x86_64
Build Date Dec 8 2018 13:08:31
Configure Command './configure' '--prefix=/bitnami/lamp56stack-linux-x64/output/php' '--enable-fpm' '--with-fpm-user=daemon' '--with-fpm-group=daemon' '--with-apxs2=/bitnami/lamp56stack-linux-x64/output/apache2/bin/apxs' '--with-expat-dir=/bitnami/lamp56stack-linux-x64/output/common' '--with-zlib-dir=/bitnami/lamp56stack-linux-x64/output/common' '--enable-mbstring=all' '--enable-soap' '--enable-bcmath' '--enable-ftp' '--with-xmlrpc' '--enable-fastcgi' '--enable-force-cgi-redirect' '--enable-cgi' '--with-imap=/bitnami/lamp56stack-linux-x64/src/imap-2007f' '--with-imap-ssl=/bitnami/lamp56stack-linux-x64/output/common' '--with-png-dir=/bitnami/lamp56stack-linux-x64/output/common' '--with-gd' '--with-zlib' '--with-curl=/bitnami/lamp56stack-linux-x64/output/common' '--with-jpeg-dir=/bitnami/lamp56stack-linux-x64/output/common' '--enable-exif' '--with-openssl=/bitnami/lamp56stack-linux-x64/output/common' '--with-ldap=/bitnami/lamp56stack-linux-x64/output/common' '--enable-calendar' '--enable-ctype' '--enable-pcntl' '--enable-session' '--with-regex=php' '--enable-spl' '--enable-zip' '--with-bz2=/bitnami/lamp56stack-linux-x64/output/common' '--enable-sockets' '--with-mcrypt=/bitnami/lamp56stack-linux-x64/output/common' '--with-icu-dir=/bitnami/lamp56stack-linux-x64/output/common' '--with-tidy=/bitnami/lamp56stack-linux-x64/output/common' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-pdo_sqlite=/bitnami/lamp56stack-linux-x64/output/sqlite' '--with-sqlite3=/bitnami/lamp56stack-linux-x64/output/sqlite' '--with-iconv=/bitnami/lamp56stack-linux-x64/output/common' '--with-libxml-dir=/bitnami/lamp56stack-linux-x64/output/common' '--with-xsl=/bitnami/lamp56stack-linux-x64/output/common' '--with-dom=/bitnami/lamp56stack-linux-x64/output/common' '--with-freetype-dir=/bitnami/lamp56stack-linux-x64/output/common' '--with-gmp=/bitnami/lamp56stack-linux-x64/output/common' '--with-gettext' '--enable-intl' '--with-readline=/bitnami/lamp56stack-linux-x64/output/common' 'CC=gcc '-L/bitnami/lamp56stack-linux-x64/output/common/lib'' 'CFLAGS=-O2 '-I/bitnami/lamp56stack-linux-x64/output/common/include' '-fPIC' '-m64'' 'LDFLAGS=-L/bitnami/lamp56stack-linux-x64/output/common/lib '-liconv'' 'CPPFLAGS=-I/bitnami/lamp56stack-linux-x64/output/common/include'
Server API FPM/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /bitnami/lamp56stack-linux-x64/output/php/lib
Loaded Configuration File /opt/bitnami/php/etc/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20131106
PHP Extension 20131226
Zend Extension 220131226
Zend Extension Build API220131226,NTS
PHP Extension Build API20131226,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

Sir Osis of Liver

When in Emor, do as the Snamors.
                              - D. Lister

temeraire02

Quote from: Sir Osis of Liver on March 24, 2019, 10:25:39 PM
Try upgrading to 2.0, then 2.0.15.

What's the best way to go back to 2.0 considering I've copied over the forum files with those from the 2.0.15 upgrade?

Sir Osis of Liver

When in Emor, do as the Snamors.
                              - D. Lister

GigaWatt

Quote from: temeraire02 on March 24, 2019, 10:35:45 PM
What's the best way to go back to 2.0 considering I've copied over the forum files with those from the 2.0.15 upgrade?

1) Download the files for 2.0 Beta 4 Public.

https://download.simplemachines.org/index.php?archive;b=4;v=48

2) Extract and copy over the current 2.0.15 files.

3) See if the forum is working. If it is, download the files for 2.0.0 and run upgrade.php.

https://download.simplemachines.org/index.php?archive;b=4;v=45

4) If the upgrade is successful, download the files for 2.0.15 and copy them over the 2.0.0 files.

5) Again, run upgrade.php.

Try doing it in lower version increments if the upgrade from 2.0.0 to 2.0.15 fails. Say, upgrade to 2.0.5, then 2.0.10, then 2.0.15 ;).

Quote from: Sir Osis of Liver on March 24, 2019, 10:51:01 PM
Do you have a clean backup of the beta 4 database?

You should have backed up before you overwrote the Beta 4 files with the 2.0.15 files, so this is actually a valid question.

Oh, and all of the attachments on the forum are kept in the attachments directory in the root of the forum, so make sure you make a backup of that as well ;). If you're doing the backup over FTP, make sure your client is set to download/upload in binary mode, not Auto or ASCII mode.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

temeraire02

Thanks I'll try this. So upgrade.php not working is the mark of a bad upgrade?

Sir Osis of Liver

No, but upgrade.php was updated along with 2.0, and some later versions may have problems upgrading earlier versions.  Officially, there were no database changes in 2.0 branch (actually, there was at least one minor change that I know of), but there may have been changes from beta versions to 2.0 final, and this could cause problems for 2.0.15 upgrade.  If you can get beta 4 up and running, you should be able to upgrade to 2.0, then 2.0.15.
When in Emor, do as the Snamors.
                              - D. Lister

temeraire02

I am trying to upgrade to 2.0 but while running upgrade.php I'm hitting this:

'omgforum.smf_advmessage_queue' is not BASE TABLE

smf_advmessage_queue exists as a view in the db. I guess I don't understand why smf_advmessage_queue and smf_advpm_messages are views if the upgrade script expects tables.

Sir Osis of Liver

Those are not core table names.  Which mysql version are you running?
When in Emor, do as the Snamors.
                              - D. Lister

Arantor

Also nothing in core SMF 2.0 uses views; it's simply too old to have leveraged that functionality as it didn't exist in MySQL at the time.
Holder of controversial views, all of which my own.


temeraire02

Thanks for the help, we've decided to go back to the old version for now as I'm leaving on a trip tomorrow.

Advertisement: