Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to install Drupal 7 on PHP 5.2.16.
When I enter MySQL data to settings.php (otherwise I am only offered SQLite), the installation fails with this diagnostics:
PHP Fatal error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /local/www/example.com/includes/database/mysql/database.inc on line 43
I enclose both PHP trace file and the output of 'php -m'.
Comment | File | Size | Author |
---|---|---|---|
php.txt | 355 bytes | Konstantin Boyandin | |
trace.txt | 10.9 KB | Konstantin Boyandin |
Comments
Comment #1
Konstantin Boyandin CreditAttribution: Konstantin Boyandin commentedThe PHP was configured this way:
./configure \
--prefix=/usr/local/php-5.2.16-cgi \
--with-libdir=lib64 \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--with-mysqli=shared,/usr/bin/mysql_config \
--with-mysql=shared \
--with-openssl=shared \
--with-kerberos \
--with-pear \
--enable-sockets \
--with-zlib=shared \
--with-curl=shared \
--with-gd=shared \
--with-jpeg-dir=shared,/usr \
--enable-mbstring \
--with-iconv=shared \
--with-imap=shared \
--with-imap-ssl=shared \
--with-ldap=shared \
--with-ldap-sasl \
--enable-pcntl \
--enable-sysvshm \
--enable-sysvsem \
--enable-sysvmsg \
--with-freetype-dir=/usr \
--with-mcrypt=shared \
--with-gettext=shared \
--enable-cgi \
--enable-fastcgi \
--enable-force-cgi-redirect
PHP is run as FastCGI. OS is Fedora 14 and Centos 5.5, in both cases Drupal 7 installation fails. The above configuration works perfectly with my production sites on Drupal 5 and Drupal 6 for years.
Comment #2
bfroehle CreditAttribution: bfroehle commentedHi Konstantin,
Is there any chance you have the PECL PDO installed instead of the default PHP PDO? See PDO Requirements for more information.
Thanks for the bug report.
Comment #3
Konstantin Boyandin CreditAttribution: Konstantin Boyandin commented2bfroehle: Negative. I haven't installed the PECL PDO; the PDO support is enabled in PHP build by default.
Right now I try to figure out how to bypass this without reconfiguring PHP entirely (adding more modules is OK) and/or hacking into Drupal code myself.
Thanks.
Comment #4
Konstantin Boyandin CreditAttribution: Konstantin Boyandin commentedLooks like I've found the solution. If PHP is built manually, the following configure option does the trick:
--with-pdo-mysql=shared
('shared' is optional)
Of course, the line
extension=pdo_mysql.so
must be added in php.ini as well.
With this fix, the installation goes on well. I suggest adding this comment to the installation manual provided with Drupal 7 distibution.
Comment #5
univate CreditAttribution: univate commentedIts already mentioned in the PDO requirements linked above.
Comment #6
cottlem CreditAttribution: cottlem commentedCould it be that the minimum requirements for Drupal 7 is PHP 5.3 & you are installing on 5.2.16?
Comment #7
Konstantin Boyandin CreditAttribution: Konstantin Boyandin commentedNo, apart from PDO for MySQL, all requirements have been met.
OK, so the only suggestion remained is that in such a case Drupal won't die with a blank screen, but reported something like 'There is no required PDO module for the database you chose, please refer to for more information".When building PHP manually, only PDO for sqlite is built by default.
Thanks.
Comment #8
bfroehle CreditAttribution: bfroehle commentedSince it seems that the db folks are always looking for more reliable detection mechanisms, perhaps we should add checking for this class constant to the list of requirements for MySQL?
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedThere is a real bug here: the database connection is loaded by
drupal_get_filename()
triggered bydrupal_check_profile()
even before the setting files is verified.That means that if you define
'driver' => 'toto'
in your settings.php, Drupal will die withFatal error: require_once() [function.require]: Failed opening required 'includes/database/toto/database.inc' in includes/database/database.inc on line 1572
. This is silly and should definitely never happen.I suggest we do the requirement checks for settings first, and then move on to checking the profile.
Comment #10
steper CreditAttribution: steper commentedDo not forget to give to setting.php permission to 777 and change than to 755, has helped me!!!
Comment #11
charlie-s CreditAttribution: charlie-s commentedI second #9. I got the error
Failed opening required 'includes/database/mysqli/database.inc'
and thought "certainly Drupal shouldn't be checking folders that don't exist".Comment #12
RowboTony CreditAttribution: RowboTony commentedI also got this error, and found this thread as one of the top Google results. Just a quick note about my situation - I was getting this error on a site that I upgraded from D6 to D7. Ultimately I discovered the problem was with the backup_migrate module. I don't know why backup migrate caused the issue, I just know it took me 3 hours to figure out the problem :( I assume backup_migrate had some setting somewhere left over from D6 that still called for the
includes/database/mysqli/database.inc
code when it was enabled. So I disabled backup_migrate and all is well, enable backup_migrate and the error happens. I'll leave backup_migrate off for now :)-- Tony