Error -- serendipity error: unable to connect to database -

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

Hi Gentlemen,

Actually the site is running php 5.4. It was the Portege sql app that is current. So I will upgrade to 5.6 and see if that fixes the problem.

I'll get back to you.
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

Hi --

I've updated the site to php 5.6. It did something as I am no longer getting the database error but still cannot connect. I'm now getting this 500 error: www.eartharchitecture.org is currently unable to handle this request but the database error seems to be cleared.

I checked the serendipity_config_local.inc.php and it looked fine. It's addressed correctly.

I am going to look at the postgres.inc.php file next.

Thanks,
Marge
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Error -- serendipity error: unable to connect to databas

Post by onli »

Could you look again which specific error message is in the log?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Error -- serendipity error: unable to connect to databas

Post by Timbalu »

I don' t know why you thought an upgrade to PHP 5.6 would solve the issue. I am pretty sure it will make things even worse, since you are still on Serendipity 1.5.1, which was not designed with PHP 5.6 in mind.

(Edit: Btw, and to make this clear, while being able to still use 5.3.x or 5.4.x PHP server versions, PHP 5.6.x is recommended to use with a current Version of Serendipity. This is a matter of software development and security.)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

Morning,

I have executed all your suggestions. The php upgrade cleared the database error but the site still will not load. I am not familiar with this software and in looking for the index location just now did not find anything on the site that looked like it. I saw a number of temporary index files only. I'm wondering if the hack theory is correct and the index file is gone. Where is it normally located?

Also -- I'm willing to go back to the server admin and have them reload support files but need direction on what else to ask for.

Thanks,
Marge
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Error -- serendipity error: unable to connect to databas

Post by onli »

Have a look at the filebrwoser in https://github.com/s9y/Serendipity. You should see the same in your webroot. There should be a index.php file.

It could still be helpful to look at the exact php error message in the log of your webserver :)
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

Hello --

I am checking back in. The specific php error that is being received by the server is:
[30-Apr-2016 17:43:46 America/Denver] PHP Fatal error: Call to undefined function pg_connect() in /home1/raelsanf/public_html/eartharchitecture/serendipity/include/db/postgres.inc.php on line 68

Suggestions?

Thanks,
Marge
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

This is what I'm seeing at that location. I previously uploaded a new version of this file. Comparing the code there appeared to be no difference. So is it access to the database that might be the issue?

$serendipity['dbConn'] = $function(
sprintf(
'%sdbname=%s user=%s password=%s',
"$host$port",
$serendipity['dbName'],
$serendipity['dbUser'],
$serendipity['dbPass']
)
);

return $serendipity['dbConn'];
}
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Error -- serendipity error: unable to connect to databas

Post by Timbalu »

mdwylde wrote:So is it access to the database that might be the issue?
That is what we were talking about.

Again Marge, check you db credentials in the config_local inc file (see above) and double check them with an independent "connect_test.php" file you make yourself and which can be found on the php website link I pasted above. This will make clear your ISP gave you a working postgres access connection and environment.

(Reset back PHP 5.6 to the one before, because you probably will get more errors after having cleared the db issue. You should do the php upgrade after having done the Serendipity upgrade.)

Otherwise the error you had before and even now "Call to undefined function pg_connect()" hints that PHPs module pgsql is not available. We said this before too. Since your hoster said it is available and running, you need to double check (see above) your connection credentials to see if your ISP is really right about it. Double checking will tell you about pgsql being available and also, if Serendipity is the problem or not.
Knowing this, we can decide to either get back to your ISP or having to tweak Serendipity (which would be strange, since that worked before, didn't it?!).

If you are not sure about your credentials in the *local* inc file, I can offer you to have a look. In this case send me a private message and obfuscate the passwort with ***. I don't need to know that.

Last question: Did you already ask your ISP about to check the postgres pg_hba.conf file and maybe having to set it trust your host?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

OK -- I'm on it.

Mare
mdwylde
Regular
Posts: 17
Joined: Wed Apr 20, 2016 10:23 pm

Re: Error -- serendipity error: unable to connect to databas

Post by mdwylde »

Hello -- I'm back.

I've downgraded the php to 5.4

It looked like the user had been disassociated from the database. I reattached and upgraded the config file. I am now getting this error:
serendipity error: unable to connect to database - exiting.

The hosting provider swears that the PHP module pgsql is there and running.

I will send the config setup separately.

Thanks,
Marge
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Error -- serendipity error: unable to connect to databas

Post by Timbalu »

mdwylde wrote:It looked like the user had been disassociated from the database. I reattached and upgraded the config file.
This is strange. Does it mean the serendipity_config_local.inc.php file did not have a line like this

Code: Select all

$serendipity['dbUser'] = 'USERNAME';
or the dbUser was set empty before?

mdwylde wrote:The hosting provider swears that the PHP module pgsql is there and running.
Did they also check with your credentials? Let them try and give you back a valid $connection_string!
Someone must have changed a successfull running connection before, by upgrading something on the servers side.

I'll give you a test file to test this youself. Place it in the Serendipity install root, where the local file lives and run it in your browser by http://www.eartharchitecture.org/exampl ... lename.php. You should get some output, or nothing, which would mean everything is fine, I think. (I have never played around with postgres before.)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply