News:

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

Main Menu

suddenly getting DB "Connection Problems"

Started by Geremia16, October 22, 2022, 11:26:40 PM

Previous topic - Next topic

Geremia16

Quote from: shawnb61 on October 27, 2022, 09:37:33 PMtriple checking file permissions throughout your file system.
I see files are 644. Is that what they should be?

Geremia16

Quote from: shawnb61 on October 27, 2022, 11:34:35 PMI would also view settings.php.  Make sure it looks good.
It's not being updated by install.php. I manually edited it, and I still get the same issue.

shawnb61

You need to figure out WHY it cannot be updated.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

m4z

#23
Quote from: m4z on October 26, 2022, 02:22:47 PMAre you seeing the errors permanently or intermittently?
Which OS and release are you using?
Did you install any updates, added IP addresses, changed anything?
If you compare Settings.php and Settings_bak.php, does everything look ok? Do you have backups (of files and the db) that you can compare to?

You didn't answer any of this. Help us help you. Something must have changed for SMF to not work anymore.


Quote from: Geremia16 on October 28, 2022, 12:13:02 AM
Quote from: shawnb61 on October 27, 2022, 09:37:33 PMtriple checking file permissions throughout your file system.
I see files are 644. Is that what they should be?

To answer that, we need to know more about your system. Based on the name "error_log" and the file format, I assume your webserver is apache. What user is it running as? (Answering the question which OS/distro you're using could already have helped answer that.) Which user (and group) do the SMF files belong to? What are the directory permissions (and, depending on the answer, user and group permissions) of your SMF folder and those leading up to it? Did you change permissions or umask recently? Are you using filesystem access control lists (ACLs) or advanced mandatory access controls (MACs) like SELinux or AppArmor?

For example / comparison, here's what I'm usually using currently:
  • OS: Debian 11
  • DB: Postgres 13.7 (d11 default)
  • Webserver: nginx (with nginx or debian default user "www-data")
  • PHP: 7.4 (php-fpm because nginx needs it)
  • Separate user (usually named "${something}-smf") for SMF install (also works well with how Debian manages Postgres)

In my setup, all my files belong to the user "${something}-smf" and group "www-data". For my setup, I need to chown all SMF files to 775 (of course, technically that's only for the dirs, but I'm lazy and I don't see a big attack vector here).


Edit: When installing, did you follow the docs?

Edit 2: Based on sudo usage, I'm loosely assuming you're using Ubuntu or similar. Is your setup similar to this?
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Geremia16

Quote from: m4z on October 26, 2022, 02:22:47 PMAre you seeing the errors permanently or intermittently?
permanently
Quote from: m4z on October 26, 2022, 02:22:47 PMWhich OS and release are you using?
slackware64-current
Quote from: m4z on October 26, 2022, 02:22:47 PMDid you install any updates, added IP addresses, changed anything?
The web server, yes, but nothing that effects the forum virtual host.
Quote from: m4z on October 26, 2022, 02:22:47 PMIf you compare Settings.php and Settings_bak.php, does everything look ok? Do you have backups (of files and the db) that you can compare to?
No changes.

m4z

Quote from: Geremia16 on October 28, 2022, 08:44:17 PM
Quote from: m4z on October 26, 2022, 02:22:47 PMDid you install any updates, added IP addresses, changed anything?
The web server, yes, but nothing that effects the forum virtual host.

What did you change and did SMF ever work after the change?
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Geremia16

Quote from: m4z on October 29, 2022, 03:02:59 AMWhat did you change and did SMF ever work after the change?
Yes.

I'm not sure why, but it seems to be a PHP issue. "install.php?step=2" is always a blank page:

Quote from: Geremia16 on October 27, 2022, 08:19:41 PM"install.php?step=2" is a blank page. I get lots of errors in error_log:

[Thu Oct 27 17:16:48.006075 2022] [php7:notice] [pid 21416:tid 140032570541760] [client ::1:48266] PHP Notice:  Trying to access array offset on value of type null in /var/www/htdocs/smf/install.php on line 386, referer: https://<redacted>/smf/install.php?step=0
[Thu Oct 27 17:16:48.006165 2022] [php7:notice] [pid 21416:tid 140032570541760] [client ::1:48266] PHP Notice:  Undefined index:  in /var/www/htdocs/smf/install.php on line 818, referer: https://<redacted>/smf/install.php?step=0
[Thu Oct 27 17:16:48.006178 2022] [php7:notice] [pid 21416:tid 140032570541760] [client ::1:48266] PHP Notice:  Trying to access array offset on value of type null in /var/www/htdocs/smf/install.php on line 818, referer: https://<redacted>/smf/install.php?step=0
[Thu Oct 27 17:16:48.006208 2022] [php7:error] [pid 21416:tid 140032570541760] [client ::1:48266] PHP Fatal error:  Uncaught Error: Function name must be a string in /var/www/htdocs/smf/install.php:818\nStack trace:\n#0 /var/www/htdocs/smf/install.php(164): DatabaseSettings()\n#1 {main}\n  thrown in /var/www/htdocs/smf/install.php on line 818, referer: https://<redacted>/smf/install.php?step=0

Oldiesmann

All of those errors are due to something being undefined:
First one: $matches isn't defined or at least isn't an array.
Second one: $databases isn't defined
Third one: $db_type isn't defined
Fourth one: We try to call $databases[$db_type]['validate_prefix'] but because $databases[$db_type] isn't defined it doesn't have any function to call, so it gives up.

The first one seems to indicate that $_SESSION['installer_temp_lang'] isn't being set, which shouldn't happen but could if no "lang_file" parameter is specified in the query string.

The other two are weird because $databases is set early in install.php and specified as a global variable (so its value will be remembered between functions) and $db_type should be set on line 815.

This appears to be some weird PHP/server issue rather than a Postgres issue.
Michael Eshom
Christian Metal Fans

Geremia16

The issue was a PCRE version mismatch. It should've been 10.40 (2022-04-14), when really it was 10.35 (2020)! Deo gratias [nofollow] SMF works now!

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: