Skip to content

Commit 2a8962a

Browse files
author
Marc Delisle
committed
Signed-off-by: Marc Delisle <marc@infomarc.info>
Added warning about the mysql extension being deprecated and removed the extension directive
1 parent 61feb94 commit 2a8962a

19 files changed

Lines changed: 47 additions & 118 deletions

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ phpMyAdmin - ChangeLog
66
+ rfe #1473 Transformation to convert Boolean value to text
77
- bug #4157 Changing users password will delete it
88
+ rfe #1474 Text transformation combines Append and Prepend
9+
+ Added warning about the mysql extension being deprecated
10+
and removed the extension directive
911

1012
4.1.1.0 (not yet released)
1113
- bug #4154 Error using UNION query

config.sample.inc.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
$cfg['Servers'][$i]['host'] = 'localhost';
3232
$cfg['Servers'][$i]['connect_type'] = 'tcp';
3333
$cfg['Servers'][$i]['compress'] = false;
34-
/* Select mysql if your server does not have mysqli */
35-
$cfg['Servers'][$i]['extension'] = 'mysqli';
3634
$cfg['Servers'][$i]['AllowNoPassword'] = false;
3735

3836
/*

doc/config.rst

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,10 @@ Server connection settings
228228

229229
Whether to enable SSL for the connection between phpMyAdmin and the MySQL server.
230230

231-
When using :config:option:`$cfg['Servers'][$i]['extension']` = ``'mysql'``,
231+
When using the ``'mysql'`` extension,
232232
none of the remaining ``'ssl...'`` configuration options apply.
233233

234-
We strongly recommend using :config:option:`$cfg['Servers'][$i]['extension']` = ``'mysqli'``
235-
when using this option.
234+
We strongly recommend the ``'mysqli'`` extension when using this option.
236235

237236
.. config:option:: $cfg['Servers'][$i]['ssl_key']
238237
@@ -286,21 +285,6 @@ Server connection settings
286285
some platforms. To use the socket mode, your MySQL server must be on the
287286
same machine as the Web server.
288287

289-
.. config:option:: $cfg['Servers'][$i]['extension']
290-
291-
:type: string
292-
:default: ``'mysqli'``
293-
294-
What php MySQL extension to use for the connection. Valid options are:
295-
296-
``mysql``
297-
The classic MySQL extension.
298-
299-
``mysqli``
300-
The improved MySQL extension. This extension became available with PHP
301-
5.0.0 and is the recommended way to connect to a server running MySQL
302-
4.1.x or newer.
303-
304288
.. config:option:: $cfg['Servers'][$i]['compress']
305289
306290
:type: boolean

doc/faq.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ generally caused by using MySQL version 4.1 or newer. MySQL changed
218218
the authentication hash and your PHP is trying to use the old method.
219219
The proper solution is to use the `mysqli extension
220220
<http://www.php.net/mysqli>`_ with the proper client library to match
221-
your MySQL installation. Your chosen extension is specified in
222-
:config:option:`$cfg['Servers'][$i]['extension']`. More
221+
your MySQL installation. More
223222
information (and several workarounds) are located in the `MySQL
224223
Documentation <http://dev.mysql.com/doc/mysql/en/old-client.html>`_.
225224

@@ -239,20 +238,19 @@ files to use font faces. Please refers to the `TCPDF manual
239238

240239
.. _faqmysql:
241240

242-
1.20 I receive the error "cannot load MySQL extension, please check PHP Configuration".
243-
---------------------------------------------------------------------------------------
241+
1.20 I receive an error about missing mysqli and mysql extensions.
242+
------------------------------------------------------------------
244243

245244
To connect to a MySQL server, PHP needs a set of MySQL functions
246245
called "MySQL extension". This extension may be part of the PHP
247246
distribution (compiled-in), otherwise it needs to be loaded
248-
dynamically. Its name is probably *mysql.so* or *php\_mysql.dll*.
247+
dynamically. Its name is probably *mysqli.so* or *php\_mysqli.dll*.
249248
phpMyAdmin tried to load the extension but failed. Usually, the
250249
problem is solved by installing a software package called "PHP-MySQL"
251250
or something similar.
252251

253252
There are currently two interfaces PHP provides as MySQL extensions - ``mysql``
254-
and ``mysqli`` and you can change which of then is being used by
255-
:config:option:`$cfg['Servers'][$i]['extension']`.
253+
and ``mysqli``. The ``mysqli`` is tried first, because it's the best one.
256254

257255
.. _faq1_21:
258256

examples/config.manyhosts.inc.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
$cfg['Servers'][$i]['port'] = '';
2424
$cfg['Servers'][$i]['socket'] = '';
2525
$cfg['Servers'][$i]['connect_type'] = 'tcp';
26-
$cfg['Servers'][$i]['extension'] = 'mysql';
2726
$cfg['Servers'][$i]['compress'] = false;
2827
$cfg['Servers'][$i]['controluser'] = 'pma';
2928
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

index.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,23 @@
291291

292292
if ($server > 0) {
293293
$client_version_str = $GLOBALS['dbi']->getClientInfo();
294-
if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)
295-
&& in_array(
296-
$GLOBALS['cfg']['Server']['extension'],
297-
array('mysql', 'mysqli')
298-
)
299-
) {
294+
if (preg_match('#\d+\.\d+\.\d+#', $client_version_str)) {
300295
$client_version_str = 'libmysql - ' . $client_version_str;
301296
}
302297
PMA_printListItem(
303298
__('Database client version:') . ' ' . $client_version_str,
304299
'li_mysql_client_version'
305300
);
306301

307-
$php_ext_string = __('PHP extension:') . ' '
308-
. $GLOBALS['cfg']['Server']['extension'] . ' '
302+
$php_ext_string = __('PHP extension:') . ' ';
303+
if (PMA_DatabaseInterface::checkDbExtension('mysqli')) {
304+
$extension = 'mysqli';
305+
} else {
306+
$extension = 'mysql';
307+
}
308+
$php_ext_string .= $extension . ' '
309309
. PMA_Util::showPHPDocu(
310-
'book.' . $GLOBALS['cfg']['Server']['extension'] . '.php'
310+
'book.' . $extension . '.php'
311311
);
312312
PMA_printListItem(
313313
$php_ext_string,

libraries/config.default.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@
187187
*/
188188
$cfg['Servers'][$i]['connect_type'] = 'tcp';
189189

190-
/**
191-
* The PHP MySQL extension to use ('mysql' or 'mysqli')
192-
*
193-
* @global string $cfg['Servers'][$i]['extension']
194-
*/
195-
$cfg['Servers'][$i]['extension'] = 'mysqli';
196-
197190
/**
198191
* Use compressed protocol for the MySQL connection
199192
*

libraries/config.values.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
1 => array(
2525
'port' => 'integer',
2626
'connect_type' => array('tcp', 'socket'),
27-
'extension' => array('mysql', 'mysqli'),
2827
'auth_type' => array('config', 'http', 'signon', 'cookie'),
2928
'AllowDeny' => array(
3029
'order' => array('', 'deny,allow', 'allow,deny', 'explicit')
@@ -194,8 +193,6 @@
194193
* Use only full paths
195194
*/
196195
$cfg_db['_overrides'] = array();
197-
$cfg_db['_overrides']['Servers/1/extension'] = extension_loaded('mysqli')
198-
? 'mysqli' : 'mysql';
199196

200197
/**
201198
* Basic validator assignments (functions from libraries/config/Validator.class.php

libraries/config/Validator.class.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ public static function testPHPErrorMsg($start = true)
194194
/**
195195
* Test database connection
196196
*
197-
* @param string $extension 'drizzle', 'mysql' or 'mysqli'
198197
* @param string $connect_type 'tcp' or 'socket'
199198
* @param string $host host name
200199
* @param string $port tcp port to use
@@ -206,7 +205,6 @@ public static function testPHPErrorMsg($start = true)
206205
* @return bool|array
207206
*/
208207
public static function testDBConnection(
209-
$extension,
210208
$connect_type,
211209
$host,
212210
$port,
@@ -219,6 +217,14 @@ public static function testDBConnection(
219217
$socket = empty($socket) || $connect_type == 'tcp' ? null : $socket;
220218
$port = empty($port) || $connect_type == 'socket' ? null : ':' . $port;
221219
$error = null;
220+
221+
if (PMA_DatabaseInterface::checkDbExtension('mysqli')) {
222+
$extension = 'mysqli';
223+
} else {
224+
$extension = 'mysql';
225+
}
226+
227+
// dead code (drizzle extension)
222228
if ($extension == 'drizzle') {
223229
while (1) {
224230
$drizzle = @drizzle_create();
@@ -315,7 +321,6 @@ public static function validateServer($path, $values)
315321
$password = $values['Servers/1/nopassword'] ? null
316322
: $values['Servers/1/password'];
317323
$test = static::testDBConnection(
318-
$values['Servers/1/extension'],
319324
$values['Servers/1/connect_type'],
320325
$values['Servers/1/host'],
321326
$values['Servers/1/port'],
@@ -365,7 +370,7 @@ public static function validatePMAStorage($path, $values)
365370
}
366371
if (! $error) {
367372
$test = static::testDBConnection(
368-
$values['Servers/1/extension'], $values['Servers/1/connect_type'],
373+
$values['Servers/1/connect_type'],
369374
$values['Servers/1/host'], $values['Servers/1/port'],
370375
$values['Servers/1/socket'], $values['Servers/1/controluser'],
371376
$values['Servers/1/controlpass'], 'Server_pmadb'

libraries/config/messages.inc.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,6 @@
586586
'Leave blank for no Designer support, suggested: [kbd]pma__designer_coords[/kbd]'
587587
);
588588
$strConfigServers_designer_coords_name = __('Designer table');
589-
$strConfigServers_extension_desc
590-
= __('What PHP extension to use; you should use mysqli if supported');
591-
$strConfigServers_extension_name = __('PHP extension to use');
592589
$strConfigServers_hide_db_desc
593590
= __('Hide databases matching regular expression (PCRE)');
594591
$strConfigServers_hide_db_name = __('Hide databases');

0 commit comments

Comments
 (0)