When upgrading a site, as from Drupal 6 to Drupal 7, if settings.php has not had the database information set in it, update.php gives this (in this case) incorrect and highly misleading error message:
A PDO database driver is required!
You need to enable the PDO_ database driver for PHP 5.2.0 or higher so that Drupal 7 can access the database.
See the system requirements page for more information.
For more background on the confusion caused by this message, see the question and the noted need of this error message to be greatly improved mentioned in support request #862682: Upgrade from d6 -> d7a6 results in PDO error: "A PDO database driver is required".
(Aside: Has the usability of the empty database array in settings.php, versus one filled with mock data, been discussed? I think mock data for the default case would be much easier to start with; i kept one to copy/paste.)
Comment | File | Size | Author |
---|---|---|---|
#26 | 887288_3.patch | 1.31 KB | David_Rothstein |
#22 | 887288.patch | 1.52 KB | catch |
#20 | 887288.patch | 1011 bytes | catch |
#19 | 887288-18.patch | 3.75 KB | David_Rothstein |
#11 | 887288.patch | 2.76 KB | catch |
Comments
Comment #1
jhedstromMarked #931492: Upgrade from D6.19 fails stating requirement for pdo while it is already installed as a duplicate.
Comment #2
Jeff Veit CreditAttribution: Jeff Veit commentedDitto. Happened to me too when I mistakenly thought I'd saved the settings.php file.
Comment #3
webchickI'm going to go ahead and bump this to critical. Drupal giving just plain wrong error messages that will actively prevent someone from installing/updating it, are release blockers IMO.
Comment #4
bjaspan CreditAttribution: bjaspan commentedWow. I was going to ask, "Does this bug really make D7 useless?" but apparently Angie thinks it does and far be it from me to question her. :-)
Comment #5
catchI also think this isn't critical, the only way to get here is to not follow the upgrade instructions at all. Here's an untested patch for it though.
Comment #6
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedIs it correct ?
$db_url
in d7 isIn d6 it is
Comment #7
catch@sivaji - it's correct because the hunk just above this one translates the Drupal 6 format to the Drupal 7 one.
Comment #8
Stevel CreditAttribution: Stevel commentedWe should also mention $db_prefix in the message, as copying only $db_url when $db_prefix was set could result in some serious trouble (e.g. a site that has '' (no prefix) and 'staging_' as prefixes).
Comment #9
catchNot sure what the text should be, this is the relevant bit from UPGRADE.txt:
The instructions here are to copy the D6 settings.php directly into the D7 installation, which isn't what I'd do personally, since settings.php changes between major versions, and I'd rather have the new documented variables available to me.
So first, I think we should just point people to upgrade.txt
Second, I don't like the instructions that are in upgrade.txt, and they certainly aren't great for explaining what to do to people who find themselves in this situation.
Comment #10
LaurentAjdnik CreditAttribution: LaurentAjdnik commentedTagging
Comment #11
catchHere's one that just points to UPGRADE.txt, I am tempted to mark this issue postponed on #295255: Clean-up the upgrade path: UPGRADE.txt, in fact I'm going to do that now and bump that to critical.
Comment #12
David_Rothstein CreditAttribution: David_Rothstein commentedInstead of doing this, I think we should just add it via update_extra_requirements() instead, so they get it as part of the nice pretty status report. (We could add a condition on the PDO driver check later to make sure it doesn't also trigger.)
If you do leave your site without database connection info in settings.php for more than a very short amount of time it's kind of a weird state to be in. (For one thing, wouldn't anyone visiting the site get redirected to install.php and be able to start going through the installer, and in some cases, e.g. a server with no root password, maybe even be able to perform a successful installation?) But I guess we do have to cater to it somehow.
Comment #13
catchI reckon you could install on a server with sqlite pretty easily, only needs a writable file path to create a new database and no password.
Comment #14
webchickThis has also hit a few people so I'd like to fix it before the next beta.
Comment #15
effulgentsia CreditAttribution: effulgentsia commentedUn-postponing, because webchick gave #295255: Clean-up the upgrade path: UPGRADE.txt the "beta blocker" tag, so let's assume that by the next beta (which is all we need to worry about in regards to update procedures), we'll have an UPGRADE.txt file that doesn't give people the wrong installation steps, and that therefore, can be referred to.
I think #11 is an adequate solution, so +1 from me on that.
#12 may be an improvement, but unless someone feels inspired to roll that patch very soon, let's go with #11, and then have a separate issue (would it really justify a priority greater than "normal"?) to make improvements.
Comment #16
webchickWell. While I'm all about the problem getting fixed ASAP, David's right that the current way is very non-Drupal and skirting our established mechanisms for this. Over at #722974: Install script returns a blank page for PHP4, PHP 5.1 (should display *something* instead) we have to do it that way, because the alternative is fatal errors. But here I think we should use the standard hook_requirements() mechanism, if we can.
Comment #17
effulgentsia CreditAttribution: effulgentsia commentedDavid indicated he thinks he can roll a patch for #12 later today. If he doesn't get to it, I'll do it.
Comment #19
David_Rothstein CreditAttribution: David_Rothstein commentedLooks like I was wrong. We can't do the normal requirements check (at least not at all easily) because in the normal workflow we'd have to bootstrap the database before that, which we can't do here...
So instead, this is pretty much just the same as the above patch, with a few small cleanups.
Comment #20
catchNo need for a new message because when the original bug is fixed we redirect to install.php anyway, which has been the case for several releases now.
Comment #21
catchComment #22
catchMy patch with David's comment.
edit: actually I changed from the !empty() to the isset as well, so it's all David's patch with the attempt to print a message just ripped out.
Comment #24
catch#22: 887288.patch queued for re-testing.
Somehow I don't think this broke the filter formats access test.
Comment #25
mlncn CreditAttribution: mlncn commentedVery nice– prevents the misleading error if i put a string or something into the $databases variable, and prints the more correct error instead:
Haven't tested this against an upgrade situation but any issues there will probably be addressed in #949102: Polish UPGRADE.txt.
Thanks Catch, David!
Comment #26
David_Rothstein CreditAttribution: David_Rothstein commentedHm, I guess it is not so bad just doing that. Redirecting to install.php is pretty weird, but it does appear to be the case that the same thing would have happened in previous Drupal versions.
There was an extra "`" character in the code comment and there shouldn't be a space before it, because the elseif() is related to the previous clause. Fixed in the attached - still RTBC.
Comment #27
webchickGreat. Committed #26 to HEAD. Nice work, folks!