5

I moved the installation to a different server. I updated the configfile in the var/ directory and the banners are served, but the admin interface is not working.

i get the error:

A fatal error occurred OpenX can't connect to the database. Because of this it isn't possible to use the administrator interface

i cleaned the cache directory in var but then i get PHP Fatal error: Call to undefined method MDB2_Error::quoteIdentifier() in /[path]/opx/lib/OA/Upgrade/VersionController.php on line 50

I dont know which version this is, but it looks like its at least 2 years old.

Is there any special cache in place im not aware of?

Any help on this would be much appreciated.

Rufinus
  • 29,200
  • 6
  • 68
  • 84
  • Did you move the database too? – alex Aug 22 '13 at 07:12
  • of course :D what a question.... the banners are served too so all is right. the user can connect to the db too. – Rufinus Aug 22 '13 at 07:22
  • 1
    There is really nothing wrong with @alex's question. It is not unusual to have webservers and databases running on separate boxes. – Shoan Aug 29 '13 at 09:00
  • in fact the database is running on a different server, but it was also moved form yet another server :). i thought alex meant i forgot about the database when i moved the server. – Rufinus Aug 30 '13 at 01:36
  • @Rufinus Basic cause of something like this.. Do you have the correct database configuration? Host, Username, Password and even possibly the correct port? – Daryl Gill Aug 30 '13 at 03:12
  • yes, as mentioned i can connect with the credentials in the config even the banners are getting delivered, the only thing not working is the admin backend. – Rufinus Aug 30 '13 at 13:40

2 Answers2

3

Mental note,.. if you have the db on a different server then openx it does not matter if you set the host to the ip of the db server and the port.. as long if you not set protocol=protocol !!!

this is by far the most stupidest thing i have ever seen, there is no need for a protocol config, as php always uses the socket if you set "localhost".

Rufinus
  • 29,200
  • 6
  • 68
  • 84
  • 2
    Speaking of stupid things… I just killed 2 hours looking into this, only to find out that my (randomly generated) DB password contains a '%' and MDB2 does not seem to likes this. After changing to another password, everything worked. – Pascal May 15 '14 at 17:09
1

It's not easy to tell exactly what's wrong here, but one can make a good guess:

As we can see from the error message, there is an object in your code that doesn't implement the method quoteIdentifier().

There are mainly two possible reasons for this: Either we're calling an older or newer version of the same Class instance which doesn't implement the method. Maybe because it's deprecated or who knows. Or the object simply isn't of the expected type.

Lo and behold, if we look for an MDB2 related class that DOES implement this method, it's the class MDB2. Not MDB2_Error! So now we know the reason for the error, it's time to speculate about the root cause.

Connecting to a database with MDB2 works roughly like this:

$mdb2 =& MDB2::connect('pgsql://usr:pw@localhost/dbnam');
if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
}

There it is. We can see that $mdb2 can actually be of type MDB2_Error, in case connecting goes wrong for some reason. So that is the cause: Your code cannot connect to the DB for some reason. So the next obvious step should be checking if your db user has the correct rights and is using the correct password. I am 100% sure your admin backend doesn't use the right credentials.

ciruvan
  • 5,143
  • 1
  • 26
  • 32