php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1118 MySql fails to work with mod_auth_mysql
Submitted: 1999-02-04 05:41 UTC Modified: 1999-02-05 09:51 UTC
From: mark-junk at domino dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 3.0.6 OS: Solaris 2.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mark-junk at domino dot com
New email:
PHP Version: OS:

 

 [1999-02-04 05:41 UTC] mark-junk at domino dot com
$conn = mysql_connect();
mysql_select_db("test"); // this database exists and can be opened using mysql interactively
$result = mysql_query("select * from mysql_auth"); // this query works interactively
echo "result=$result<BR>";  // echoes "result=<BR>"
echo(mysql_error()); // echoes nothing

while($row = mysql_fetch_object($result)) { // gives a warning : 0 is not a MySQL result index in /export/htdocs/mark/extranet/users.php3 on line 15

*** THIS IS NOW RESOLVED:

The PHP-MySql conflicts with the mod_auth_mysql module in apache - if you compile one or both of them
as shared objects (i.e. DLLs), then this fixes the problem.

I'm running PHP as a shared object now and it all works. Mark

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-02-05 09:51 UTC] zeev
First, check the return value from *every* MySQL function call you make.  From your file
it's not clear at all where PHP fails.  The only that's obvious is that the mysql_query() call fails.
The fact that mysql_error() returns nothing also implies that mysql_connect() failed right
from the beginning.
The bottom line is that mod_auth_mysql doesn't affect PHP's behavior in any way, whether it's
compiled into the server or dynamically loaded.  Your problem is most probably unrelated,
as Rasmus said, there's a good chance your mysql_connect() fails because of an invalid
username (never rely on the runtime username, unless you *really* know what you're doing
and perfectly understand the difference between uid's, euid's, and the way MySQL uses them
to determine the current default username;  You're much better off explicitly supplying
the username and password).

Start with a simple script, something like:

<?
error_report(E_ALL);
if (!mysql_connect($username)) {
  print "mysql_connect() failed\n";
}
?>

That would probably give us all the clues we need.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 09:01:26 2025 UTC