diff --git a/ChangeLog b/ChangeLog index 7b7fe2d9c0..d00437f540 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ phpMyAdmin - ChangeLog + rfe #1473 Transformation to convert Boolean value to text - bug #4157 Changing users password will delete it + rfe #1474 Text transformation combines Append and Prepend ++ Added warning about the mysql extension being deprecated + and removed the extension directive 4.1.1.0 (not yet released) - bug #4154 Error using UNION query diff --git a/config.sample.inc.php b/config.sample.inc.php index 7dcf528788..83fe50cb96 100644 --- a/config.sample.inc.php +++ b/config.sample.inc.php @@ -31,8 +31,6 @@ $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; -/* Select mysql if your server does not have mysqli */ -$cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['AllowNoPassword'] = false; /* diff --git a/doc/config.rst b/doc/config.rst index 6cd6da11ae..4973685bc6 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -228,11 +228,10 @@ Server connection settings Whether to enable SSL for the connection between phpMyAdmin and the MySQL server. - When using :config:option:`$cfg['Servers'][$i]['extension']` = ``'mysql'``, + When using the ``'mysql'`` extension, none of the remaining ``'ssl...'`` configuration options apply. - We strongly recommend using :config:option:`$cfg['Servers'][$i]['extension']` = ``'mysqli'`` - when using this option. + We strongly recommend the ``'mysqli'`` extension when using this option. .. config:option:: $cfg['Servers'][$i]['ssl_key'] @@ -286,21 +285,6 @@ Server connection settings some platforms. To use the socket mode, your MySQL server must be on the same machine as the Web server. -.. config:option:: $cfg['Servers'][$i]['extension'] - - :type: string - :default: ``'mysqli'`` - - What php MySQL extension to use for the connection. Valid options are: - - ``mysql`` - The classic MySQL extension. - - ``mysqli`` - The improved MySQL extension. This extension became available with PHP - 5.0.0 and is the recommended way to connect to a server running MySQL - 4.1.x or newer. - .. config:option:: $cfg['Servers'][$i]['compress'] :type: boolean diff --git a/doc/faq.rst b/doc/faq.rst index a59f2fe204..36a4e5aaf7 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -218,8 +218,7 @@ generally caused by using MySQL version 4.1 or newer. MySQL changed the authentication hash and your PHP is trying to use the old method. The proper solution is to use the `mysqli extension `_ with the proper client library to match -your MySQL installation. Your chosen extension is specified in -:config:option:`$cfg['Servers'][$i]['extension']`. More +your MySQL installation. More information (and several workarounds) are located in the `MySQL Documentation `_. @@ -239,20 +238,19 @@ files to use font faces. Please refers to the `TCPDF manual .. _faqmysql: -1.20 I receive the error "cannot load MySQL extension, please check PHP Configuration". ---------------------------------------------------------------------------------------- +1.20 I receive an error about missing mysqli and mysql extensions. +------------------------------------------------------------------ To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension". This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded -dynamically. Its name is probably *mysql.so* or *php\_mysql.dll*. +dynamically. Its name is probably *mysqli.so* or *php\_mysqli.dll*. phpMyAdmin tried to load the extension but failed. Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar. There are currently two interfaces PHP provides as MySQL extensions - ``mysql`` -and ``mysqli`` and you can change which of then is being used by -:config:option:`$cfg['Servers'][$i]['extension']`. +and ``mysqli``. The ``mysqli`` is tried first, because it's the best one. .. _faq1_21: diff --git a/examples/config.manyhosts.inc.php b/examples/config.manyhosts.inc.php index 3ab6572bcc..b188aa8b86 100644 --- a/examples/config.manyhosts.inc.php +++ b/examples/config.manyhosts.inc.php @@ -23,7 +23,6 @@ foreach ($hosts as $host) { $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; - $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['controluser'] = 'pma'; $cfg['Servers'][$i]['controlpass'] = 'pmapass'; diff --git a/index.php b/index.php index ce38a83974..238d11ab3a 100644 --- a/index.php +++ b/index.php @@ -291,12 +291,7 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) { if ($server > 0) { $client_version_str = $GLOBALS['dbi']->getClientInfo(); - if (preg_match('#\d+\.\d+\.\d+#', $client_version_str) - && in_array( - $GLOBALS['cfg']['Server']['extension'], - array('mysql', 'mysqli') - ) - ) { + if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) { $client_version_str = 'libmysql - ' . $client_version_str; } PMA_printListItem( @@ -304,10 +299,15 @@ if ($GLOBALS['cfg']['ShowServerInfo'] || $GLOBALS['cfg']['ShowPhpInfo']) { 'li_mysql_client_version' ); - $php_ext_string = __('PHP extension:') . ' ' - . $GLOBALS['cfg']['Server']['extension'] . ' ' + $php_ext_string = __('PHP extension:') . ' '; + if (PMA_DatabaseInterface::checkDbExtension('mysqli')) { + $extension = 'mysqli'; + } else { + $extension = 'mysql'; + } + $php_ext_string .= $extension . ' ' . PMA_Util::showPHPDocu( - 'book.' . $GLOBALS['cfg']['Server']['extension'] . '.php' + 'book.' . $extension . '.php' ); PMA_printListItem( $php_ext_string, diff --git a/libraries/config.default.php b/libraries/config.default.php index 9c433031c3..f0fdf171c5 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -187,13 +187,6 @@ $cfg['Servers'][$i]['ssl_ciphers'] = null; */ $cfg['Servers'][$i]['connect_type'] = 'tcp'; -/** - * The PHP MySQL extension to use ('mysql' or 'mysqli') - * - * @global string $cfg['Servers'][$i]['extension'] - */ -$cfg['Servers'][$i]['extension'] = 'mysqli'; - /** * Use compressed protocol for the MySQL connection * diff --git a/libraries/config.values.php b/libraries/config.values.php index b8767710b4..ac1e8058e6 100644 --- a/libraries/config.values.php +++ b/libraries/config.values.php @@ -24,7 +24,6 @@ $cfg_db['Servers'] = array( 1 => array( 'port' => 'integer', 'connect_type' => array('tcp', 'socket'), - 'extension' => array('mysql', 'mysqli'), 'auth_type' => array('config', 'http', 'signon', 'cookie'), 'AllowDeny' => array( 'order' => array('', 'deny,allow', 'allow,deny', 'explicit') @@ -194,8 +193,6 @@ $cfg_db['Export']['texytext_null'] = 'short_string'; * Use only full paths */ $cfg_db['_overrides'] = array(); -$cfg_db['_overrides']['Servers/1/extension'] = extension_loaded('mysqli') - ? 'mysqli' : 'mysql'; /** * Basic validator assignments (functions from libraries/config/Validator.class.php diff --git a/libraries/config/Validator.class.php b/libraries/config/Validator.class.php index e6a958880f..cd1737563b 100644 --- a/libraries/config/Validator.class.php +++ b/libraries/config/Validator.class.php @@ -194,7 +194,6 @@ class PMA_Validator /** * Test database connection * - * @param string $extension 'drizzle', 'mysql' or 'mysqli' * @param string $connect_type 'tcp' or 'socket' * @param string $host host name * @param string $port tcp port to use @@ -206,7 +205,6 @@ class PMA_Validator * @return bool|array */ public static function testDBConnection( - $extension, $connect_type, $host, $port, @@ -219,6 +217,14 @@ class PMA_Validator $socket = empty($socket) || $connect_type == 'tcp' ? null : $socket; $port = empty($port) || $connect_type == 'socket' ? null : ':' . $port; $error = null; + + if (PMA_DatabaseInterface::checkDbExtension('mysqli')) { + $extension = 'mysqli'; + } else { + $extension = 'mysql'; + } + + // dead code (drizzle extension) if ($extension == 'drizzle') { while (1) { $drizzle = @drizzle_create(); @@ -315,7 +321,6 @@ class PMA_Validator $password = $values['Servers/1/nopassword'] ? null : $values['Servers/1/password']; $test = static::testDBConnection( - $values['Servers/1/extension'], $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], @@ -365,7 +370,7 @@ class PMA_Validator } if (! $error) { $test = static::testDBConnection( - $values['Servers/1/extension'], $values['Servers/1/connect_type'], + $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'], $values['Servers/1/controluser'], $values['Servers/1/controlpass'], 'Server_pmadb' diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 56d3146c9b..a3536a4dc0 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -586,9 +586,6 @@ $strConfigServers_designer_coords_desc = __( 'Leave blank for no Designer support, suggested: [kbd]pma__designer_coords[/kbd]' ); $strConfigServers_designer_coords_name = __('Designer table'); -$strConfigServers_extension_desc - = __('What PHP extension to use; you should use mysqli if supported'); -$strConfigServers_extension_name = __('PHP extension to use'); $strConfigServers_hide_db_desc = __('Hide databases matching regular expression (PCRE)'); $strConfigServers_hide_db_name = __('Hide databases'); diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php index 80fc04b2a1..62d5bdc02b 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -33,7 +33,6 @@ $forms['Servers']['Server'] = array('Servers' => array(1 => array( 'socket', 'ssl', 'connect_type', - 'extension', 'compress', 'nopassword'))); $forms['Servers']['Server_auth'] = array('Servers' => array(1 => array( diff --git a/libraries/database_interface.inc.php b/libraries/database_interface.inc.php index 2ad1706a25..3ace178d23 100644 --- a/libraries/database_interface.inc.php +++ b/libraries/database_interface.inc.php @@ -12,7 +12,6 @@ if (! defined('PHPMYADMIN')) { require_once './libraries/DatabaseInterface.class.php'; -$extension = null; if (defined('TESTSUITE')) { /** * For testsuite we use dummy driver which can fake some queries. @@ -22,13 +21,12 @@ if (defined('TESTSUITE')) { } else { /** - * check for requested extension + * First check for the mysqli extension, as it's the one recommended + * for the MySQL server's version that we support */ - $extensionName = $GLOBALS['cfg']['Server']['extension']; - if (! PMA_DatabaseInterface::checkDbExtension($extensionName)) { + $extension = 'mysqli'; + if (! PMA_DatabaseInterface::checkDbExtension($extension)) { - // if it fails try alternative extension ... - // and display an error ... $docurl = PMA_Util::getDocuLink('faq', 'faqmysql'); $doclink = sprintf( __('See %sour documentation%s for more information.'), @@ -36,39 +34,31 @@ if (defined('TESTSUITE')) { '[/a]' ); - /** - * @todo add different messages for alternative extension - * and complete fail (no alternative extension too) - */ - PMA_warnMissingExtension( - $extensionName, - false, - $doclink - ); - - if ($extensionName === 'mysql') { - $alternativ_extension = 'mysqli'; - } else { - $alternativ_extension = 'mysql'; - } - - if (! PMA_DatabaseInterface::checkDbExtension($alternativ_extension)) { - // if alternative fails too ... + $extension = 'mysql'; + if (! PMA_DatabaseInterface::checkDbExtension($extension)) { + // warn about both extensions missing and exit PMA_warnMissingExtension( - $extensionName, + 'mysqli|mysql', true, $doclink ); + } elseif (empty($_SESSION['mysqlwarning'])) { + trigger_error( + __( + 'You are using the mysql extension which is deprecated in ' + . 'phpMyAdmin. Please consider installing the mysqli ' + . 'extension.') . ' ' . $doclink, + E_USER_WARNING + ); + // tell the user just once per session + $_SESSION['mysqlwarning'] = true; } - - $GLOBALS['cfg']['Server']['extension'] = $alternativ_extension; - unset($alternativ_extension); } /** * Including The DBI Plugin */ - switch($GLOBALS['cfg']['Server']['extension']) { + switch($extension) { case 'mysql' : include_once './libraries/dbi/DBIMysql.class.php'; $extension = new PMA_DBI_Mysql(); @@ -77,10 +67,6 @@ if (defined('TESTSUITE')) { include_once './libraries/dbi/DBIMysqli.class.php'; $extension = new PMA_DBI_Mysqli(); break; - case 'drizzle' : - include_once './libraries/dbi/DBIDrizzle.class.php'; - $extension = new PMA_DBI_Drizzle(); - break; } } $GLOBALS['dbi'] = new PMA_DatabaseInterface($extension); diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index 1bdfd9415e..d1991691d8 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -70,7 +70,7 @@ function PMA_RTN_main($type) /** * Display a warning for users with PHP's old "mysql" extension. */ - if ($GLOBALS['cfg']['Server']['extension'] === 'mysql') { + if (! PMA_DatabaseInterface::checkDbExtension('mysqli')) { trigger_error( __( 'You are using PHP\'s deprecated \'mysql\' extension, ' diff --git a/setup/lib/common.inc.php b/setup/lib/common.inc.php index b9fc2260cc..f1509f1466 100644 --- a/setup/lib/common.inc.php +++ b/setup/lib/common.inc.php @@ -43,7 +43,6 @@ $GLOBALS['ConfigFile']->setPersistKeys( 'Servers/1/host', 'Servers/1/port', 'Servers/1/socket', - 'Servers/1/extension', 'Servers/1/connect_type', 'Servers/1/auth_type', 'Servers/1/user', diff --git a/setup/lib/index.lib.php b/setup/lib/index.lib.php index c7c6ae312e..265850cc83 100644 --- a/setup/lib/index.lib.php +++ b/setup/lib/index.lib.php @@ -325,21 +325,6 @@ function PMA_performConfigChecks() ); } - // - // $cfg['Servers'][$i]['extension'] - // warn about using 'mysql' - // - if ($cf->getValue("Servers/$i/extension") == 'mysql') { - $title = PMA_lang(PMA_langName('Servers/1/extension')) - . " ($server_name)"; - PMA_messagesSet( - 'notice', - "Servers/$i/extension", - $title, - __('You should use mysqli for performance reasons.') - ); - } - // // $cfg['Servers'][$i]['auth_type'] // warn about full user credentials if 'auth_type' is 'config' diff --git a/test/libraries/PMA_ConfigFile_test.php b/test/libraries/PMA_ConfigFile_test.php index 1220491b88..98db14a9a8 100644 --- a/test/libraries/PMA_ConfigFile_test.php +++ b/test/libraries/PMA_ConfigFile_test.php @@ -69,16 +69,6 @@ class PMA_ConfigFile_Test extends PHPUnit_Framework_TestCase $this->object->getDefault('fontsize') ); - if (extension_loaded('mysqli')) { - $expect = "mysqli"; - } else { - $expect = "mysql"; - } - - $this->assertEquals( - $expect, - $this->object->getDefault('Servers/1/extension') - ); $this->assertEquals( array(), $this->object->getConfig() diff --git a/test/libraries/PMA_SetupIndex_test.php b/test/libraries/PMA_SetupIndex_test.php index 2a6e59ab66..727354e9be 100644 --- a/test/libraries/PMA_SetupIndex_test.php +++ b/test/libraries/PMA_SetupIndex_test.php @@ -434,7 +434,6 @@ class PMA_SetupIndex_Test extends PHPUnit_Framework_TestCase 'ForceSSL', 'Servers/1/AllowNoPassword', 'Servers/1/auth_type', - 'Servers/1/extension', 'Servers/1/ssl' ); diff --git a/test/libraries/core/PMA_getTableCount_test_dis.php b/test/libraries/core/PMA_getTableCount_test_dis.php index 698ca232cb..11dda57438 100644 --- a/test/libraries/core/PMA_getTableCount_test_dis.php +++ b/test/libraries/core/PMA_getTableCount_test_dis.php @@ -47,7 +47,6 @@ class PMA_GetTableCount_Test extends PHPUnit_Framework_TestCase function testTableCount() { - $GLOBALS['cfg']['Server']['extension'] = 'mysql'; $GLOBALS['cfg']['Server']['host'] = 'localhost'; $GLOBALS['cfg']['Server']['user'] = 'root'; diff --git a/test/test_data/config.inc.php b/test/test_data/config.inc.php index 6282c69015..e8576ba4c2 100644 --- a/test/test_data/config.inc.php +++ b/test/test_data/config.inc.php @@ -13,5 +13,4 @@ $cfg['Servers'][$i]['host'] = 'localhost'; $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; -$cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'cookie';