Page MenuHomePhabricator

cli php should check db modules
Closed, ResolvedPublic

Description

$ php maintenance/install.php --pass=none test test
Setting up database...
PHP Fatal error: Call to undefined function mysql_select_db() in .../DatabaseMysql.php on line 312


Version: 1.17.x
Severity: enhancement

Details

Reference
bz26492

Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:20 PM
bzimport set Reference to bz26492.
bzimport added a subscriber: Unknown Object (MLST).

Is this still an issue on MySQL?

C:\Projects\MediaWiki\maintenance>php install.php --pass=none test test
Setting up database...
DB connection error: MySQL functions missing, have you compiled PHP with the --with-mysql option?
.
Check the host, username and password below and try again....

I see the error on SQLite ("DatabaseInstaller::setupSchemaVars: unexpected DB connection error") and Oracle (caused by OracleInstaller::setupDatabase() being a dummy that always returns an OK status).

I tested this enhancement once again.

# Current environment
root@US1:~# php -r 'mysql_connect();'
PHP Fatal error:  Call to undefined function mysql_connect() in Command line code on line 1
root@US1:~# dpkg --list | grep php
ii  libapache2-mod-php5                 5.5.9+dfsg-1ubuntu4.19           amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php5                                5.5.9+dfsg-1ubuntu4.19           all          server-side, HTML-embedded scripting language (metapackage)
ii  php5-cli                            5.5.9+dfsg-1ubuntu4.19           amd64        command-line interpreter for the php5 scripting language
ii  php5-common                         5.5.9+dfsg-1ubuntu4.19           amd64        Common files for packages built from the php5 source
ii  php5-json                           1.3.2-2build1                    amd64        JSON module for php5
ii  php5-readline                       5.5.9+dfsg-1ubuntu4.19           amd64        Readline module for php5

# Get a clean source of Mediawiki (the latest release 1.17.5)
root@US1:~/dev# wget https://releases.wikimedia.org/mediawiki/1.17/mediawiki-1.17.5.tar.gz
...
root@US1:~/dev# tar xvf mediawiki-1.17.5.tar.gz
...

# Test
root@US1:~/dev/mediawiki-1.17.5# php maintenance/install.php --pass=none test test
PHP 5.5.9-1ubuntu4.19 is installed.
***Could not find a suitable database driver! You need to install a database driver for PHP.
The following database types are supported: MySQL, PostgreSQL, Oracle, SQLite.
If you are on shared hosting, ask your hosting provider to install a suitable database driver.
If you compiled PHP yourself, reconfigure it with a database client enabled, for example using ./configure --with-mysql.
If you installed PHP from a Debian or Ubuntu package, then you also need install the php5-mysql module.***
Warning: Could not find eAccelerator <http://eaccelerator.sourceforge.net>, APC <http://www.php.net/apc>, XCache <http://trac.lighttpd.net/xcache/> or WinCache <http://www.iis.net/download/WinCacheForPhp>.
Object caching is not enabled.
Could not find GD library or ImageMagick.
Image thumbnailing will be disabled.
Warning: The intl PECL extension <http://pecl.php.net/intl> is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.
If you run a high-traffic site, you should read a little on Unicode normalization <http://www.mediawiki.org/wiki/Unicode_normalization_considerations>.
PHP Warning:  call_user_func_array() expects parameter 2 to be array, string given in /root/dev/mediawiki-1.17.5/includes/installer/CliInstaller.php on line 162

Well, from the test result, this enhancement has been implemented in version 1.17.5 as it shows me that Could not find a suitable database driver! You need to install a database driver for PHP.

Krinkle claimed this task.

@fsgmhoward Thanks! I assume that means this issue can be closed. If you like, could you test your environment again with a more current version of the software? E.g. MediaWiki 1.27 or MediaWiki 1.28.

(For the records, I think @fsgmhoward intentionally installed 1.17 because the task description up there says "Version: 1.17.x". Indeed for future reference, just testing with the latest version is fine - no need to install ancient versions. :)