|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4223 PHP calls MySQL with apache user instead of connected user
Submitted: 2000-04-24 03:04 UTC Modified: 2002-05-26 13:40 UTC
From: louis at sitebysite dot nl Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0 Release Cand OS: RedHat 6.1
Private report: No CVE-ID: None
 [2000-04-24 03:04 UTC] louis at sitebysite dot nl
This is hard to reproduce, but every once in a while PHP tries to use the
user running apache instead of the user specified in mysql_pconnect() to
query MySQL.  So after a pconnect with user X, you get a "access denied
for user www" from the query. Our config is a dual-processor webserver
and dual-processor MySQL machine.  With low traffic, it does not occur.  
It also appears to occur only when using write locks on tables, but I 
can't positively verify that - only that I haven't seen it happen on sites
not using table locks, yet.

PHP configured with:
./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr --enable-track-vars --with-gd=../gd1.4 --with-ttf --without-pcre-regex --with-mm=../mm-1.0.12 --enable-inline-optimization --disable-debug --with-recode --with-t1lib --with-dbase

Also running the Zend optimizer for RC1.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-30 13:52 UTC]
** Warning - uneducated guess **

This seems like it might be a mysql configuration issue.

Please review the MySQL documentation on performance - try increasing the max number of connections, etc...

Also, what user does you web server run as - www by chance?
 [2000-07-30 17:07 UTC]
User response:
"As far as I can gather it has something to do with the
wait_timeout of MySQL.  This was set pretty low.  I think
the persistent connections outlived the connections on the
database side during quiet periods.  The error doesn't
seem to appear if I up this timeout or bring down the
life span of the apache child processes.  Is there a
way to set a timeout on the persistent connections
on the php side?  That would enable one to match it
against the MySQL timeout and make sure it never happens."

 [2000-08-08 22:30 UTC]
I don?t kwno any way, moving to feature request
 [2002-04-27 13:26 UTC]
this isn't a feature request.
 [2002-05-26 13:40 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 02 16:01:27 2023 UTC