Zen Cart Logo
Forums / General Questions / PHP Warning: mysqli_connect(): (28000/1045)

PHP Warning: mysqli_connect(): (28000/1045)

Locked

Views: 4,657

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
28 Feb 2015, 6:04 PM
#1
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

PHP Warning: mysqli_connect(): (28000/1045)

Hello
I am currently running a fresh install of 154 with the responsive_avonlee_contempo template. I have Image Handler installed and google site map. I am generating debug logs that read:

[22-Feb-2015 14:56:46 America/Denver] PHP Warning:  mysqli_connect(): (28000/1045): Access denied for user 'cwrealey'@'localhost' (using password: NO) in /home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php on line 62

I checked the query factory php page line 62 and it reads:
$this->link = mysqli_connect($zf_host, $zf_user, $zf_password);
$connectionRetry--;
The script surrounding this entry is:```
function connect($zf_host, $zf_user, $zf_password, $zf_database, $zf_pconnect = 'false', $zp_real = false) {
$this->database = $zf_database;
$this->user = $zf_user;
$this->host = $zf_host;
$this->password = $zf_password;
$this->pConnect = $zf_pconnect;
$this->dieOnErrors = $dieOnErrors;
if (defined('DB_CHARSET')) $dbCharset = DB_CHARSET;
if (isset($options['dbCharset'])) $dbCharset = $options['dbCharset'];
if (!function_exists('mysqli_connect')) die ('Call to undefined function: mysqli_connect(). Please install the MySQL Connector for PHP');
$connectionRetry = 10;
while (!isset($this->link) || ($this->link == FALSE && $connectionRetry !=0) )
{
$this->link = mysqli_connect($zf_host, $zf_user, $zf_password);
$connectionRetry--;
}
if ($this->link) {
if (mysqli_select_db($this->link, $zf_database)) {
if (isset($dbCharset) ) {
mysqli_query($this->link, "SET NAMES '" . $dbCharset . "'");
if (function_exists('mysqli_set_charset')) {
mysqli_set_charset($this->link, $dbCharset);
} else {
mysqli_query($this->link, "SET CHARACTER SET '" . $dbCharset . "'");
}
}
$this->db_connected = true;
if (!defined('DISABLE_MYSQL_TZ_SET')) {
mysqli_query($this->link, "SET time_zone = '" . substr_replace(date("O"),":",-2,0) . "'");
}
return true;
} else {
$this->set_error(mysqli_errno($this->link), mysqli_error($this->link), $dieOnErrors);
return false;
}
} else {
$this->set_error(mysqli_connect_errno(), mysqli_connect_error(), $dieOnErrors);
return false;

I saw a similar thread from 2012 but not solved and this was a while ago. Any suggestions on how to fix it would be appreciated. I download the new version of Zen Cart from the Zen website. My site is [www.makupartist.com](http://www.makupartist.com) and to get to zen cart you will need to [www.makupartist.com/154](http://www.makupartist.com/154) 
Thanks
T
28 Feb 2015, 6:29 PM
#2
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: PHP Warning: mysqli_connect(): (28000/1045)

That message typically indicates an issue communicatung (authenticating) with the database. Common causes are invalid cedentials, server denial by security rules, or 3rd party code still using direct "mysql_*" function calls.

Would suggest searching for the phrase "mysql_" in all files (and update or remove the 3rd party code if found). Mixed mysql_ and mysqli_ calls are the most common cause (Zen Cart > 1.5.1 uses mysqli_ internally).

If intermitten may also be worth asking the hosting provider (can check server logs / enable logging) to further assist tracking down the cause.

1 Mar 2015, 12:22 AM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: mysqli_connect(): (28000/1045)

Which version of each of the plugins is being run? Were the latest version of those plugins (compatible with ZC 1.5.4) downloaded?

2 Mar 2015, 3:38 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP Warning: mysqli_connect(): (28000/1045)

tbokich:

Access denied for user 'cwrealey'@'localhost' (using password: NO)
Is "cwrealey" really the username for your MySQL database INSIDE the MySQL settings?
Why is there no password for that user? (It only says "using password: NO" if you've given it no password in your configure.php files)

14 Mar 2015, 3:20 PM
#5
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

DrByte:

Is "cwrealey" really the username for your MySQL database INSIDE the MySQL settings?
Why is there no password for that user? (It only says "using password: NO" if you've given it no password in your configure.php files)

Hi. No the data base user name is not cwrealey. I did a search of all the php files on the site and cannot find a reference to cwrealey so do not know where it is coming from. I also searched the data base and could not find this entry either

14 Mar 2015, 8:58 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: mysqli_connect(): (28000/1045)

Might I suggest installing lat9's MyDebug Backtrace: http://www.zen-cart.com/downloads.php?do=file&id=1879

It should provide a better indication of the origin of the error rather than just starting at the query_factory.

15 Mar 2015, 11:25 AM
#7
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PHP Warning: mysqli_connect(): (28000/1045)

tbokich:

Hello
I am currently running a fresh install of 154 with the responsive_avonlee_contempo template. I have Image Handler installed and google site map. I am generating debug logs that read:

How often is this error occurring? Same time every day? Only when you generate a new sitemap, or is it seemingly random?

tbokich:

[22-Feb-2015 14:56:46 America/Denver] PHP Warning: mysqli_connect(): (28000/1045): Access denied for user 'cwrealey'@'localhost' (using password: NO) in /home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php on line 62

> 
> I checked the query factory php page line 62 and it reads:

This isn't the file where you'll find the error.  The error will be caused by whatever module/code is calling this function. 

Although it was mentioned that the problem could be caused by the use of a 'mysql_*' function call, this *isn't* the cause of your problem.  The log file provided clearly shows that it is using the correct (for V1.5.4) mysqli_* function call.  

  > **tbokich:**
>
>  I have Image Handler installed and google site map.

The image handler appears to be functioning correctly, so I doubt that that will be the cause. 

The Google Sitemap *is* a *very strong* suspect though, because this module runs somewhat independently of any other store code, and will be one of the few places where the Database credentials used could be different than any other store function.   

  > **tbokich:**
>
> No the data base user name is not cwrealey
>  

This name is being picked up for *somewhere*, and my guess is that it could be the account name used to access your server?  

It is my suspicion that the Google Sitemap (or some other module) isn't loading the 'application_top' or is missing a 'global $db' variable setting, and because of this there are no $db login credentials to be had, and the server is trying to use a default 'account_username@password'  (which is obviously failing). 

If your account name *isn't* "cwrealey" then I feel that you have a really serious issue (such as the site being compromised with a poorly written hacker script),  but I'd rather not consider this possibly at this stage, at least not until you can determine which add-on module is calling the mysqli_connect function and/or the source of the 'cwrealey' name. 

Cheers
RodG
  
15 Mar 2015, 11:46 AM
#8
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PHP Warning: mysqli_connect(): (28000/1045)

ps. I take back my previous 'diagnosis' of the problem.

I've not been able to find a cause , BUT, after typing "cwrealey@localhost" into Google I'm seeing over 5000 matches from many different sites that don't appear to be ZenCart related.

If this isn't due to some sort of hack attempt (SQL injection?) it could be a default server setting (I found one reference to this, but seem to have lost it again).

In other words, I don't think that this a a 'zencart' issue at all.

I'll let you know if I can find out anything more.

Cheers
RodG

15 Mar 2015, 6:02 PM
#9
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

mc12345678:

Might I suggest installing lat9's MyDebug Backtrace: http://www.zen-cart.com/downloads.php?do=file&id=1879

It should provide a better indication of the origin of the error rather than just starting at the query_factory.

Hi, Thanks I installed it and got this:
[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] PHP Warning: mysqli_connect(): (28000/1045): Access denied for user 'cwrealey'@'localhost' (using password: NO) in /home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php on line 62
[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

[15-Mar-2015 11:42:16 America/Denver] #1 mysqli_connect() called at [/home2/latexinn/public_html/154/includes/classes/db/mysql/query_factory.php:62]
#2 queryFactory->connect() called at [/home2/latexinn/public_html/154/includes/classes/class.phpbb.php:32]
#3 phpBB->phpBB() called at [/home2/latexinn/public_html/154/includes/autoload_func.php:79]
#4 require(/home2/latexinn/public_html/154/includes/autoload_func.php) called at [/home2/latexinn/public_html/154/includes/application_top.php:158]
#5 require(/home2/latexinn/public_html/154/includes/application_top.php) called at [/home2/latexinn/public_html/154/index.php:26]

15 Mar 2015, 6:13 PM
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: PHP Warning: mysqli_connect(): (28000/1045)

Look in your /includes/configure.php file. There's a constant there named DIR_WS_PHPBB.

Look in the folder that that constant specifies; there's a file named config.php (the phpBB configuration file). The credentials for the phpBB database are parsed out of that file, which apparently has invalid database information.

15 Mar 2015, 6:29 PM
#11
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

lat9:

Look in your /includes/configure.php file. There's a constant there named DIR_WS_PHPBB.

Look in the folder that that constant specifies; there's a file named config.php (the phpBB configuration file). The credentials for the phpBB database are parsed out of that file, which apparently has invalid database information.

This is what I got: define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', '/home2/latexinn/public_html/154/');
I could not find a folder names store, zen cart sits in the 154 folder but the only config file is in the includes folder or in admin.

15 Mar 2015, 6:44 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: PHP Warning: mysqli_connect(): (28000/1045)

Do you even have a phpBB installation for your store? What's your setting for Configuration->My Store->Enable phpBB Linkage?

15 Mar 2015, 6:59 PM
#14
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

lat9:

Look in your /includes/configure.php file. There's a constant there named DIR_WS_PHPBB.

Look in the folder that that constant specifies; there's a file named config.php (the phpBB configuration file). The credentials for the phpBB database are parsed out of that file, which apparently has invalid database information.

Here is what I get: define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', '/home2/latexinn/public_html/154/');
I could not find a store folder or if it means the zen cart folder is 154, In 154 the config file is of course in the includes folder and the database info is correct on this file
Thanks

16 Mar 2015, 6:24 AM
#15
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: mysqli_connect(): (28000/1045)

tbokich:

Here is what I get: define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', '/home2/latexinn/public_html/154/');
I could not find a store folder or if it means the zen cart folder is 154, In 154 the config file is of course in the includes folder and the database info is correct on this file
Thanks

The issue as lat9 is trying to lead you to is now identified not to be a file issue, but now is a database issue. In your old store, even though you may not have had phpBB installed, it was activated before upgrading the database... Now in zC 1.5.4 the software goes out and tries to do something based on that setting and stops working...

Now you need to change the setting in the database so that it doesn't go out and do that... Not at a computer to specifically identify the sql that will specifically solve the problem.

16 Mar 2015, 11:21 AM
#16
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: PHP Warning: mysqli_connect(): (28000/1045)

mc12345678:

The issue as lat9 is trying to lead you to is now identified not to be a file issue, but now is a database issue. In your old store, even though you may not have had phpBB installed, it was activated before upgrading the database... Now in zC 1.5.4 the software goes out and tries to do something based on that setting and stops working...

Now you need to change the setting in the database so that it doesn't go out and do that... Not at a computer to specifically identify the sql that will specifically solve the problem.
There's no SQL to run, you simply go to the admin's Configuration->My Store->Enable phpBB Linkage? setting. If it's true, set it to false.

If it's already set to false, then there's something else afoot.

16 Mar 2015, 11:47 AM
#17
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: PHP Warning: mysqli_connect(): (28000/1045)

lat9:

There's no SQL to run, you simply go to the admin's Configuration->My Store->Enable phpBB Linkage? setting. If it's true, set it to false.

If it's already set to false, then there's something else afoot.

Yeah, sorry. If I had taken a moment to realize that the issue did not prevent admin access, I would have approached my response differently...the sql is taken care of by ZC when making the selection described above.

25 Mar 2015, 10:40 AM
#18
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

I am also having a similar problem```
[25-Mar-2015 09:59:54 UTC] PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in
/homepages/20/d503465712/htdocs/xxxx/xxxx/includes/classes/db/mysql/query_factory.php on line 62


I am using v1.5.4 template Carlisle Fresh
25 Mar 2015, 11:38 AM
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP Warning: mysqli_connect(): (28000/1045)

adb34:

I am also having a similar problem```
[25-Mar-2015 09:59:54 UTC] PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in
/homepages/20/d503465712/htdocs/xxxx/xxxx/includes/classes/db/mysql/query_factory.php on line 62

> 
> I am using v1.5.4 template Carlisle Fresh
When did this problem start? How does that compare with when you first started using v1.5.3 or 1.5.4?  Did your hosting company do any upgrades just before this problem started?

I suspect mysqli.default_socket is incorrectly configured in your server's php.ini ... which is something your hosting company must fix.
12 Apr 2015, 12:54 PM
#20
tbokich avatar

tbokich

New Zenner

Join Date:
Aug 2007
Posts:
64
Plugin Contributions:
0

Re: PHP Warning: mysqli_connect(): (28000/1045)

lat9:

There's no SQL to run, you simply go to the admin's Configuration->My Store->Enable phpBB Linkage? setting. If it's true, set it to false.

If it's already set to false, then there's something else afoot.

Very smart person it fixed it in a flash. I have had similar problems though I could not track it down for the last two years. Hostmonster is the server and we have been fighting over space for all this time. Unless you are checking the log folder there is no other indication for this until you hosting company threatens to shut you off because you file count is to high. Thank you so much for your help
T