MediaWiki-to-DokuWiki-Importer icon indicating copy to clipboard operation
MediaWiki-to-DokuWiki-Importer copied to clipboard

could not find driver

Open nstephens opened this issue 11 years ago • 9 comments

I have a server properly running a mediawiki install and a dokuwiki install.. however when I try to run this script, I am given a very bland "could not find driver" error, and then it exits. This error leads me to believe that it is a PDO issue, however I cannot seem to work around that.. I have verified that I have everything installed as I should (i think?), but nada. I even went so far as to setup a new virtualbox install of debian with a fresh install of everything below, and received the same error.

I know that the script says it has only been tested against an older version of mediawiki.. is that why it is failing for me? I figured I would give it a try and see how well it went (expecting it to miss some newer features potentially), but I didn't think it would die this early in the process.

Am I doing something wrong, or is this behaviour to be expected?

Thanks!

Debian 6.0.7 32bit mysqld 5.1 php 5.3.3-7+squeeze16 apache 2.2.16 mediawiki 1.21.1 dokuwiki 2013-05-10a

nstephens avatar Aug 13 '13 17:08 nstephens

For testing purposes, I grabbed an older backup of the mediawiki install (1.16) and installed that with the same results. I am now leaning more towards this being a php/pdo_mysql issue, but I'm hoping you might have some insight!

nstephens avatar Aug 13 '13 17:08 nstephens

There's five variables it tries to grab from LocalSettings.php that may be where the problem is. The variables are

  • $wgDBtype
  • $wgDBserver
  • $wgDBname
  • $wgDBuser
  • $wgDBpassword

Since this is a working MediaWiki installation then it's probably just not grabbing one or more of those variables correctly. Can you copy and paste those lines in here? Please replace the sensitive information with garbage text.

tetsuo13 avatar Aug 13 '13 21:08 tetsuo13

Here ya go! The only weirdness in here is that for some reason (i think during testing a long time ago) i have the same values commented out immediately following them, as shown below. The other possibility is that my password could have special characters that are messing it up. I have brackets, semicolons, etc in the password..

$wgDBtype = "mysql"; #mysql $wgDBserver = "localhost"; #localhost $wgDBname = "my_wp"; #my_wp $wgDBuser = "my_wp"; #my_wp $wgDBpassword = "complex-password-with-lots-of-special-characters"; #same password commented out

nstephens avatar Aug 13 '13 22:08 nstephens

I've rewritten the LocalSettings.php parsing routine so now it can handle inline comments and strings as complex as "Q?u>U(]\c;e+~e0l|;g~df<}byG/hJ?'iL.!7HO7s"+". Please give the latest in master another try to see if it fixes the issue.

tetsuo13 avatar Aug 15 '13 03:08 tetsuo13

I got this because LocalSettings.php did not contain a value for "wgDBtype". I added this value to my MediaWiki's LocalSettings.php and the error went away. ("mysql" is the default, so I guess MediaWiki does not need it explicitly defined unless it is not "mysql" - but the Importer script does)

$wgDBtype = "mysql";

AlasdairKing avatar Jan 26 '14 17:01 AlasdairKing

I have the same issue here. I have a working MediaWiki installation that uses PostgreSQL. and I have $wgDBtype = "postgres"; in my MW LocalSettings.php but I get could not find driver error when I run the script in terminal. my DB setting in LocalSettings.php as follows:

## Database settings
$wgDBtype = "postgres";
$wgDBserver = "localhost";
$wgDBname = "my_wiki";
$wgDBuser = "postgres";
$wgDBpassword = "123456";

# Postgres specific settings
$wgDBport = "5432";
$wgDBmwschema = "mediawiki";

@tetsuo13 please reopen this bug.

sajjadG avatar Mar 04 '14 18:03 sajjadG

I had the same error, "could not find driver". I found out, that my LocalSettings.php had some leading spaces in front of the variables. After removing them, it was possible to migrate. So this string here fixed it : sed -i 's/^[ \t]*//' LocalSettings.php

fischfutter avatar Dec 18 '20 09:12 fischfutter

Ah! The issue seems to be related to this function:

https://github.com/tetsuo13/MediaWiki-to-DokuWiki-Importer/blob/767955b590fdb46d20f29e943c3d18aa0a413180/src/MediaWiki2DokuWiki/MediaWiki/Settings.php#L150

It parses each line in LocalSettings.php and assumes that variables start at the beginning of the line. This could be fixed by calling trim() on each line before attempting to use it.

tetsuo13 avatar Dec 18 '20 19:12 tetsuo13

I've got the same error "could not find driver"

Database settings

$wgDBtype = "mysql"; $wgDBserver = "localhost:8083"; $wgDBname = "nameaufmediawikidb"; $wgDBuser = "user"; $wgDBpassword = "pwd";

What should I do? Have I add a trim() into these function above? And where exactly? I had tried it, but maybe on wrong place.

maximiliansport avatar Aug 09 '23 08:08 maximiliansport