Use of mysqli instead of PDO


(mrdleigh) #1

My 3rd party host company, Powweb, has mysqli and I have it activated (here’s my output from loaded extensions):

Array ( [0] => libxml [1] => xmlwriter [2] => xmlrpc [3] => xmlreader [4] => xml [5] => wddx [6] => tokenizer [7] => session [8] => SimpleXML [9] => SPL [10] => sockets [11] => PDO [12] => standard [13] => Reflection [14] => pspell [15] => posix [16] => pdo_sqlite [17] => SQLite [18] => mysqli [19] => mysql [20] => ming [21] => mhash [22] => mcrypt [23] => mbstring [24] => json [25] => imap [26] => iconv [27] => hash [28] => gettext [29] => gd [30] => ftp [31] => filter [32] => exif [33] => dom [34] => dbase [35] => dba [36] => date [37] => curl [38] => ctype [39] => calendar [40] => bcmath [41] => zlib [42] => pcre [43] => openssl [44] => xsl [45] => cgi )

They DO have PDO, but ONLY for sqlite. So when I install, I get this message:

Piwik requires either the mysqli extension or both the PDO and pdo_mysql extensions

From that I think that it SHOULD work. Is Piwik getting confused and seeing that PDO exists but not for mysql and then ignoring that it can use the mysqli choice?

I confirmed that it’s .0.4.5 that I’m installing.

Thanks!


(vipsoft) #2

See http://forum.piwik.org/index.php?showtopic=1324 re: escapeshellcmd

You’ll want to select mysqli or have your hosting provider install the pdo_mysql extension. Note: mysqli won’t be presented as an option if you have an older mysqli extension that’s missing mysqli_set_charset().


(mrdleigh) #3

I’m not sure how the escapeshellcmd effects me (this is a Linux Debian environment).

How does one “select” mysqli? I didn’t see where I was presented any options.


(vipsoft) #4

You have PDO but not pdo_mysql, so you won’t see a choice for PDO_MYSQL.

You have mysqli but if it doesn’t have the funtion to set encoding, then you won’t see that choice.

If your hosting environment doesn’t satisfy at least one reqt, you won’t see choices… cuz you can’t go to the next screen.


(mrdleigh) #5

Are you talking about “mysqli_client_encoding” ?

Are you saying that if “mysqli_client_encoding” doesn’t exist, then Piwik will assume that mysqli does not exist?

I’d like to get this resolved, so I need some specifics to go back to my hosting company with.

Thanks


(vipsoft) #6

Here’s a simple test you can run:

<?php
$extensions = @get_loaded_extensions();
if (in_array('mysqli', $extensions) && function_exists('mysqli_set_charset')) {
  echo "MySQLi is supported\n";
}
if (in_array('PDO', $extensions) && in_array('pdo_mysql', $extensions)) {
  echo "PDO MySQL is supported\n";
}

(mrdleigh) #7

Thanks. We seem to be down to ‘mysqli_set_charset’ not existing as the sticking issue. I’m still checking with my hosting company and waiting on a response from them. Don’t suppose there’s a work around for the use of that particular function?
Thanks!


(vipsoft) #8

I’ve added a compat function in 0.5.

You can also try this patch: http://dev.piwik.org/trac/changeset/1595


(mrdleigh) #9

Thank you. This got me past the error. Now I’m getting another error on the database setup. (I’ve posted in a different thread).