Koozali.org: home of the SME Server

Horde - DB Error: connect failed

Offline edb

  • *
  • 546
  • +0/-0
Horde - DB Error: connect failed
« on: September 02, 2007, 07:40:29 PM »
After upgrading my PHP to version 4.3.11 something happened to my horde password which now generates the following error:

A fatal error has occurred
DB Error: connect failed
Details have been logged for the administrator.

I have fixed all my other apps and can temporarily fix this Horde password issue but when I reboot it changes my password again.
Here is what I've tried:

use mysql
update user set password=('horde') where user='horde'; flush privileges;

config show horde
config delprop horde DbPassword
config show horde
config setprop horde DbPassword horde
signal-event post-upgrade
signal-event reboot

Also changed the password in horde config as well.

Each time I do a signal-event post-upgrade & signal-event reboot, the issue begins all over again.

If I just change the mysql password and the horde config password everything works fine even after a reboot, but if I issue the signal-event commands it runs a horde script that screws everthing up for me.

What else do I need to look at to sync the mysql password with the horde config password I'm obviously missing something?

Thanks

edb
« Last Edit: September 02, 2007, 08:01:34 PM by edb »
......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #1 on: September 02, 2007, 10:54:18 PM »
If you upgrade or downgrade PHP version, you must install pear modules again.
See horde.org to list the necesary pear modules.
For now, you must install DB:

pear install DB

After all run:

pear ua

If you have errors, see the pear page and run the commands shows in the home page.


Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #2 on: September 02, 2007, 11:01:25 PM »
I really don't think that's the issue ...

If I change the mysql password, config DB password and the horde config password everything works great even after a reboot.
If the signal-event post-upgrade and signal-event reboot commands are issued the horde scripts are launched at the reboot and overwrite everything again.

......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #3 on: September 03, 2007, 12:34:42 AM »
In /etc/e-smith/templates/home/httpd/html/horde/script/db you have the script mysql_set_password.sql

Code: [Select]
CONNECT mysql;

REPLACE INTO user (host, user, password)
    VALUES (
        'localhost',
        'horde',
        password('{$horde{DbPassword}}')
    );

FLUSH PRIVILEGES;


and in /etc/e-smith/home/db/configuration/migrate the script HordePassword
Code: [Select]
{
    my $horderec = $DB->get('horde')
        || $DB->new_record('horde', {type => 'service'});
    my $horde_pw = $horderec->prop('DbPassword');
    if (not $horde_pw or length($horde_pw) < 57)
    {
        use MIME::Base64 qw(encode_base64);

        $horde_pw = "not set due to error";
        if ( open( RANDOM, "/dev/urandom" ) )
        {
            my $buf;
            # 57 bytes is a full line of Base64 coding, and contains
            # 456 bits of randomness - given a perfectly random /dev/random
            if ( read( RANDOM, $buf, 57 ) != 57 )
            {
                warn("Short read from /dev/random: $!");
            }
            else
            {
                $horde_pw = encode_base64($buf);
                chomp $horde_pw;
            }
            close RANDOM;
        }
        else
        {
            warn "Could not open /dev/urandom: $!";
        }
        $horderec->set_prop('DbPassword', $horde_pw);
    }
}


and in /home/e-smith/db/configuration the key horde:

Code: [Select]
horde=service|DbPassword|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|imp|installed|status|enabled
Check if you have all these files ok.
You can execute signal-event post-install and then reboot to see if your changes are permannent.

If you see under post-upgrade directory you note horde password changes.

Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #4 on: September 03, 2007, 04:03:49 AM »
Hi PicsOne

Yes, I have all the files you indicated.
The only thing different was you indicated to try a signal-event post-install rather than a signal-event post-upgrade so I tried that. Now on reboot, I still get the DB Error just like before but now I cannot logon at the server console or server-manager.

What the heck happened? This is too weired ...
Root & Admin passwords are screwed up for some reason now. It won't accept what I had previously.

edb
......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #5 on: September 03, 2007, 05:48:16 AM »
Edb
signal-event post-install recreate the installation wizard. You must go to the console and retype the root password and configure the server parameters, same as when the first time you have installed SME.

Im sorry if you have not been at server console to run the signal-event post-install


Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #6 on: September 03, 2007, 06:14:06 AM »
Good thing I'm doing this in VMWARE Player ... it's Ok PicsOne

Ok, so I fired-up another instance and upgraded to PHP4.3.11 ... did a signal-event post upgrade as it says to do after the install followed by a reboot. My GroupOffice gives Database error: connect(localhost, gofficeuser, $Password) failed, Horde gives error A fatal error has occurred DB Error: connect failed.

So then I do a signal-event post-install as you instructed followed by a signal-event reboot and on reboot it brings me to the configure your server wizard but it starts with confirming the Domain name not with the part where you specify the admin password. So again it ends up coming to the server prompt but I can no longer login as root with my previous password.

The post-install wipes my previous password but doesn't give me an option anywhere to retype it so it locks me out?

edb
......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #7 on: September 03, 2007, 06:55:47 AM »
Very strange.
Try to reset root and admin password as descrybed here:

http://wiki.contribs.org/SME_Server:Documentation:FAQ#Reset_the_root_and_admin_password

and restore to the original problem with mysql pass error.

Then I can't imagine neither fix to your issue.

In theory PHP upgrade don't modify any mysql variable. The only think I thing is you have used mysqli to connect with PHP to mysql, but mysqli only work with PHP 5+.

Ia have two SME7.2 in my machine with VMware for test purposes. Tell me where I can download your PHP 4.3.11 and then I test in my test server.

Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #8 on: September 03, 2007, 07:08:42 AM »
I downloaded the PHP4.3.11 rpms from here http://download.fedora.redhat.com/pub/fedora/linux/core/updates/3/i386/

I downloaded the following rpms:

php-4.3.11-2.8.i386.rpm
php-devel-4.3.11-2.8.i386.rpm
php-domxml-4.3.11-2.8.i386.rpm
php-gd-4.3.11-2.8.i386.rpm
php-imap-4.3.11-2.8.i386.rpm
php-ldap-4.3.11-2.8.i386.rpm
php-mbstring-4.3.11-2.8.i386.rpm
php-mysql-4.3.11-2.8.i386.rpm
php-pear-4.3.11-2.8.i386.rpm

They install just fine with "yum localinstall php-*.rpm"
php -v  displays the new version number as PHP 4.3.11 after the install.

Give it a try and you'll see what I mean.

edb
......

Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #9 on: September 03, 2007, 09:57:29 PM »
It looks like the passwords are encrypted and php-mysql connect doesn't like that?

The reason I suggest this is because the passwords within mysql, the Horde config file & the DB config all seem to be encrypted (long string of random characters) though the "config show horde" displays the same encrypted password as is within the horde config.php file (they do match).

If I try to access Webmail in this setup I get the DB error.

Now ...

If I change the mysql password for user "horde" using the "old_password('horde')" directive and then change the horde DbPassword to be "horde" and the horde config.php file to be "horde" everything works fine even after a reboot. Meaning I can access Webmail, GOffice and Mambo perfectly fine.

However, if the signal-event post-upgrade command is issued all passwords go back to an encrypted state?
Then I can not access Webmail, GOffice or Mambo anymore.

This must be the key to the issue ... but I'm not sure as to why.

edb
......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #10 on: September 05, 2007, 08:31:05 AM »
Hello edb
Well, I have reproduce your problem exactly. I have installed php 4.3.11 from fedora as you tell me.
The same symptom, db errors, and in phpmyadmin also.

I have fixed with php4.4.0.
First I have unistalled 4.3.11 with rpm -e --nodeps php php-devel etc
Then I have download the original SME php version, install, update pear, post-upgrade and reboot. SME return to original state, and horde and phpmyadmin run ok. I suppose the 4.3.11 version from fedora is not 100% compatible with SME.

Then I have upgrade to php 4.4.0.

Before update to 4.4.0 remove any php accelerator or zend optimizer. At the end you can install eaccelerator or zend optimizer with the new version.

I have used this php 4.4.0 version for the last year without problems.

Proceed as following:

Add dag repo
Code: [Select]
/sbin/e-smith/db yum_repositories set dag repository \
Name 'Dag - EL4' \
BaseURL 'http://apt.sw.be/redhat/el4/en/$basearch/dag' \
EnableGroups no \
GPGCheck yes \
GPGKey http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt \
Visible no \
Exclude freetype,htop,iptraf,rsync,syslinux \
status disabled
Code: [Select]
expand-template /etc/yum.conf
Create a local dir and download rpm
Code: [Select]
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-pear-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-pgsql-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-snmp-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-xmlrpc-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-xslt-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-devel-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-domxml-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-gd-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-imap-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-ldap-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-mbstring-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-mcrypt-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-mhash-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-mysql-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-ncurses-4.4.0-1.0.rhel4.ct.i386.rpm
wget http://mirror.cheetaweb.com/redhat/4ES/i386/RPMS.cheeta/php-odbc-4.4.0-1.0.rhel4.ct.i386.rpm

Install with yum because this version require dependency  js, libmcrypt, mhash and sablotron

Code: [Select]
yum --enablerepo=* localinstall *.rpm
Then, update pear as follow:
Code: [Select]
pear install --force XML_RPC
pear upgrade --force PEAR-1.3.6 Archive_Tar-1.3.1 Console_Getopt-1.2
pear upgrade --force PEAR-1.4.11
pear upgrade PEAR
pear ua

and finally

Code: [Select]
signal-event post-upgrade
signal-event reboot

Ofcourse you can add several custom-templates for load php modules, as xmlrpc, xslt, and so on. Then expand and restart.
I suggest to compile your eaccelerator if you update php, then load.

Now I have running ok php 4.4.0 with horde, phpmyadmin and any php aplication.


Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #11 on: September 05, 2007, 03:44:18 PM »
Thank you Normando!

I'll give that a try tonight.
Can the original PHP version be installed with YUM from the SME repo?
How do you compile ZEND into your PHP upgrade (just curious)?

Thanks again for helping me out here.

edb
......

Offline Normando

  • *
  • 841
  • +2/-1
    • Unixlan
Re: Horde - DB Error: connect failed
« Reply #12 on: September 05, 2007, 05:52:36 PM »
First I have unistall all php 4.3.11 version with rpm -e --nodeps php php-devel etc
Then I have download the original rpm from mirrors:

Code: [Select]
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/e-smith-php-1.12.0-4.el4.sme.noarch.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-domxml-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-gd-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-imap-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-ldap-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-mbstring-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-mysql-4.3.9-3.22.5.i386.rpm
wget http://mirror.contribs.org/smeserver/releases/7.2/smeos/i386/SME/RPMS/php-pear-4.3.9-3.22.5.i386.rpm

If you upgrade php remember to exclude from centos and sme updates repositories

About Zend, I refer to Zend Optimizer, not zend php. Zend optimizer can get for any php version.
Eaccelerator can compile very easy. You need gcc cpp and other stuff for devel compile packages.
Then follow the instruction in the eaccelerator web page.
Then copy the module eaccelerator to /usr/lib/php4 and load with new custom template.


Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #13 on: September 05, 2007, 08:52:30 PM »
Ok, Normando
I use ZEND Optimizer so I won't worry about compiling anything.

Quote
If you upgrade php remember to exclude from centos and sme updates repositories
I guess that is the negative side to not staying with the standard install.

Thanks very much for all your help here!!  :smile:
......

Offline edb

  • *
  • 546
  • +0/-0
Re: Horde - DB Error: connect failed
« Reply #14 on: March 18, 2008, 03:48:15 AM »
Normando

I believe I made a mistake and without thinking allowed SME to install all available updates which broke Horde because of the above modification I had made.

The updates that were installed that were Horde related were as follows:

e-smith-horde.noarch                     1.13.0-22.el4.sme      smeos           
e-smith-imp.noarch                       1.13.0-11.el4.sme      smeos           
horde.noarch                             3.1.5-1.el4.sme        smeos           
imp-h3.noarch                            4.1.5-1.el4.sme        smeos           
ingo-h3.noarch                           1.1.4-1.el4.sme        smeos           

Is there a way to correct this oversight on my part by or will a restore of the Horde directory from backup work to correct it?
Now when I go to webmail and logon it just says "webpage cannot be found" and it is due to the updates that were applied.  :-(

Thanks

edb
« Last Edit: March 18, 2008, 04:01:49 AM by edb »
......