|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp-pear-mysqlDb (last revision 2016-09-22 06:17 UTC by waqasrana11 at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-09-22 08:42 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2016-09-22 08:42 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 22:00:01 2025 UTC |
Description: ------------ require_once 'DB.php'; $dsn = 'mysql://root:@localhost/web_cms'; $options = array( 'debug' => 2, 'portability' => DB_PORTABILITY_ALL, ); $dbh =& DB::connect($dsn, $options); if (DB::isError($dbh)) { die($dbh->getMessage()); } function connect($dsninfo, $persistent = false) { $db = new DB(); if (!($db->assertExtension('mysql'))) { return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); } $this->dsn = $dsninfo; if ($dsninfo['protocol'] && $dsninfo['protocol'] == 'unix') { $dbhost = ':' . $dsninfo['socket']; } else { $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; if ($dsninfo['port']) { $dbhost .= ':' . $dsninfo['port']; } } $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect'; if ($dbhost && $dsninfo['username'] && isset($dsninfo['password'])) { $conn = @$connect_function($dbhost, $dsninfo['username'], // error in the following line $dsninfo['password']); } elseif ($dbhost && $dsninfo['username']) { $conn = @$connect_function($dbhost, $dsninfo['username']); } elseif ($dbhost) { $conn = @$connect_function($dbhost); } else { $conn = false; } Test script: --------------- Fatal error in line 132 of fileC:\xampp\htdocs\cms-includes\pear\DB\mysql.php - mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead this lin # 132 $dsninfo['password']); so my db credentials are db --> 'web_cms' username-> 'root' password --> ' ' hots --> localhost so how can i provide blank or no password in dsn = mysql//:user:pass@host/db Expected result: ---------------- just remove this error and should display result