Signed-off-by: Marc Delisle <marc@infomarc.info>
Added warning about the mysql extension being deprecated and removed the extension directive
This commit is contained in:
parent
61feb946a5
commit
2a8962aa95
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@ -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
|
||||
|
||||
12
doc/faq.rst
12
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
|
||||
<http://www.php.net/mysqli>`_ 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 <http://dev.mysql.com/doc/mysql/en/old-client.html>`_.
|
||||
|
||||
@ -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:
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
18
index.php
18
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,
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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, '
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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'
|
||||
);
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user