php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47594 'password' parameter in my.cnf not honored even with mysqli_options()
Submitted: 2009-03-08 00:23 UTC Modified: 2009-03-18 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jarrod dot makin at heartinternet dot co dot uk Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: 5.2.9 OS: linux Centos 5.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jarrod dot makin at heartinternet dot co dot uk
New email:
PHP Version: OS:

 

 [2009-03-08 00:23 UTC] jarrod dot makin at heartinternet dot co dot uk
Description:
------------
Just like http://bugs.php.net/bug.php?id=43812

OS: Centos 5.2
php: 5.2.8
msqli api: 5.1.30 

mysql  Ver 14.14 Distrib 5.1.30, for pc-linux-gnu (i686) using readline
5.1


Contents of my.cnf

[client]
user = web35-poker
host = localhost
password = password

[mysql]
database = web35-poker

Reproduce code:
---------------
$db = mysqli_init();
$db->options(MYSQLI_READ_DEFAULT_FILE,'/path/to/file.cnf');
$db->real_connect();

if ( mysqli_connect_errno() ) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
}


Expected result:
----------------
I expect $db to be a database handle

Actual result:
--------------
The following error message:
Connect failed: Access denied for user 'web35-poker'@'localhost' (using password: NO) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-10 10:26 UTC] jani@php.net
"On Unix platforms, MySQL ignores configuration files that are
world-writable. This is intentional as a security measure."

So check the permissions first.

 [2009-03-10 22:29 UTC] jarrod dot makin at heartinternet dot co dot uk
Good point. I should have detailed this in my message.
The file is 600, readable to just the script owner (it is running through suexec). The username part is read in and understood, however the password part appears to be ignored.
 [2009-03-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-10-16 13:08 UTC] john dot coll at csoft dot co dot uk
php 5.2.14
Linux lucian 2.6.9-89.29.1.EL #1 Tue Sep 28 09:26:45 EDT 2010 x86_64
exaclty the same problem
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 03:03:42 2022 UTC