Topic on Project:Support desk

Can't upgrade (xampp)

10
Hydorn (talkcontribs)

Hi,

When I run maintenance/update.php, I get the error "DatabaseBase::factory no viable database extension found for type 'mysql'":

mywiki/maintenance$ php update.php 
MediaWiki 1.24.1 Updater

[1c0b983f] [no req]   Exception from line 890 of /opt/lampp/htdocs/mywiki/includes/db/Database.php: DatabaseBase::factory no viable database extension found for type 'mysql'
Backtrace:
#0 /opt/lampp/htdocs/mywiki/includes/db/LoadBalancer.php(737): DatabaseBase::factory(string, array)
#1 /opt/lampp/htdocs/mywiki/includes/db/LoadBalancer.php(610): LoadBalancer->reallyOpenConnection(array, boolean)
#2 /opt/lampp/htdocs/mywiki/includes/db/LoadBalancer.php(490): LoadBalancer->openConnection(integer, boolean)
#3 /opt/lampp/htdocs/mywiki/includes/GlobalFunctions.php(3632): LoadBalancer->getConnection(integer, array, boolean)
#4 /opt/lampp/htdocs/mywiki/maintenance/update.php(136): wfGetDB(integer)
#5 /opt/lampp/htdocs/mywiki/maintenance/doMaintenance.php(101): UpdateMediaWiki->execute()
#6 /opt/lampp/htdocs/mywiki/maintenance/update.php(206): require_once(string)
#7 {main}

I searched in other threads, and didn't understand where the error comes from: my PHP version is 5.5.9-1ubuntu4.9 (so I guess it's ok), and my wiki works hosted on localhost works fine. So, how can I upgrade my MediaWiki version?

88.130.101.155 (talkcontribs)

The error

DatabaseBase::factory no viable database extension found for type 'mysql'

means that MySQL is not available from inside PHP. You can upload a PHP file to your server with the following content:

<?php phpinfo();

When you call this file with your webbrowser, you will see information on your PHP installation.

Make sure that the MySQL extension of PHP is enabled (by editing php.ini)! After you enabled it, restart the server for your changes to take effect. The phpinfo() output then should contain a section on MySQL and it should say that MySQL is "enabled".

Ciencia Al Poder (talkcontribs)

MediaWiki now requires mysqli driver instead of mysql, IIRC

88.130.71.198 (talkcontribs)

I don't know that, but newer versions of PHP definitely have the mysql extension deprecated in favour of mysqli. So you surely should use the mysqli extension, if that is available.

Thanks for noting!

Ciencia Al Poder (talkcontribs)

Well, apparently mediawiki now uses mysqli as default, and mysql as fallback, but both are still supported.

Hydorn (talkcontribs)

OK, here is my php configuration (got with phpinfo()) : Is mysqli or mysql disabled? Not clear to me...

88.130.97.252 (talkcontribs)

In the line "MySQL(i) support" it both times says "enabled". In a system of mine I also have both extensions enabled and MySQL is running nicely with that. So I guess it's also not a conflict between those two. That should be fine...

88.130.76.192 (talkcontribs)

I think the problem is the way how PHP is accessed. When you call a file with the web browser, one version of PHP may be invoked, while when you call a file from the shell, another version may be used.

Since you say that your wiki is basically working (not now, but before you upgraded MediaWiki), I guess that the PHP version, which is used when you hit a page with the browser, is fine. update.php however uses the shell, which might be a completely different version.

On the shell, please type this command

php -i

This will (among other things) display a list of the loaded extensions. Look there to see if mysql or mysqli are installed!

This post was posted by 88.130.76.192, but signed as 88.130.97.252.

Hydorn (talkcontribs)

With 'php -i', mysql or mysqli aren't in the list. But I don't understand, the wiki should use the PHP version of XAMPP, no?

88.130.102.228 (talkcontribs)
With 'php -i', mysql or mysqli aren't in the list

And that is your problem. When you access PHP from the command line, in CLI mode, neither the mysql, nor the mysqli extension is loaded. Make sure that also on the command line version of PHP these extensions are activated! This can be done by editing the according php.ini files and activating the extenion(s) there.

Reply to "Can't upgrade (xampp)"