mysqli_connect(): (HY000/2002): No such file or directory -- Causes/Solution?
Using 1.5.8a. Upgraded to a new server approximately 1 week ago, but have not had any website issues until this morning. Now getting multiple log errors (200+) such as the following:
Code:
Request URI: /admin/index.php?cmd=whos_online&t=15, IP address: xx.xxx.xxx.xx, Language id
#1 mysqli_connect() called at [/includes/classes/db/mysql/query_factory.php:76]
#2 queryFactory->connect() called at [/admin/includes/init_includes/init_database.php:18]
#3 require(/admin/includes/init_includes/init_database.php) called at [/admin/includes/application_bootstrap.php:157]
#4 require_once(/admin/includes/application_bootstrap.php) called at [/admin/index.php:5]
--> PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /includes/classes/db/mysql/query_factory.php on line 76.
and
Code:
Request URI: /whitmanreg-folders-c-119_144_171/whitmanreg-coin-folder-4985-american-women-quarters-w-s-mint-20222025-p-4253.html, IP address: 114.119.132.171, Language id
#1 mysqli_connect() called at [/includes/classes/db/mysql/query_factory.php:76]
#2 queryFactory->connect() called at [/includes/init_includes/init_database.php:22]
#3 require(/includes/init_includes/init_database.php) called at [/includes/application_top.php:199]
#4 require(/includes/application_top.php) called at [/index.php:25]
--> PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /includes/classes/db/mysql/query_factory.php on line 76.
I did not change any database settings during the migration. The only other thing I did was redirect all site traffic from my old domain to my new domain. Since not all the same pages exist on the new site, it will redirect to the homepage if the page isn't found.
Any ideas what may be causing this, or what needs to be done to prevent in the future? Thanks in advance!
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
You say yourself that not all pages are on the new site.
The log files are complaining about that very fact.
The first is looking for /admin/index.php?cmd=whos_online&t=15 and the second for /whitmanreg-folders-c-119_144_171/whitmanreg-coin-folder-4985-american-women-quarters-w-s-mint-20222025-p-4253.html.
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
Quote:
Originally Posted by
dbltoe
You say yourself that not all pages are on the new site.
The log files are complaining about that very fact.
The first is looking for /admin/index.php?cmd=whos_online&t=15 and the second for /whitmanreg-folders-c-119_144_171/whitmanreg-coin-folder-4985-american-women-quarters-w-s-mint-20222025-p-4253.html.
Thanks, dbltoe, but I'm still confused as to why all of a sudden this would be an issue. It's been working fine for a week with no errors/logs. And the admin/whos online page is a stock page that was refreshing just fine every 15sec when it threw an error. It gave me an unable to connect to the database error and then when I clicked to check current status it worked just fine.
As for the other pages that don't exist on the new site, why wouldn't it just redirect to the homepage when the page doesn't exist (which is has been doing just fine for the past week) rather than throw an error?
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
New server means MANY options/settings that could be different from before.
If you are using the root for the store, make sure your first line in the .htaccess looks something like:
Code:
ErrorDocument 404 https://YOURSITE.com/
Where YOURSITE is changed to match your domain.
For the missing file, I was wondering if the w should be a u since we are being numismatic here.
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
Quote:
Originally Posted by
dbltoe
New server means MANY options/settings that could be different from before.
If you are using the root for the store, make sure your first line in the .htaccess looks something like:
Code:
ErrorDocument 404 https://YOURSITE.com/
Where YOURSITE is changed to match your domain.
For the missing file, I was wondering if the w should be a u since we are being numismatic here.
Ok, thank you--I'll give that a try and see if it prevents future errors. It's just weird though--errors only produced for a few minutes earlier today (and 200+ overnight) and nothing since. No changes made to database or files. Makes me wonder if it's more of a server issue rather than a website/zencart issue? Either way, thanks for the help.
As for the missing file, it's not missing at all--it's a working page: https://thecoinauthority.com/whitman...25-p-4253.html
Shouldn't have thrown an error to begin with...weird.
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
If I really helped, you can pay me with a 1920 silver dollar in any condition. :P
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
Quote:
Originally Posted by
mcqueeneycoins
Using 1.5.8a. Upgraded to a new server approximately 1 week ago, but have not had any website issues until this morning. Now getting multiple log errors (200+) such as the following:
Code:
Request URI: /admin/index.php?cmd=whos_online&t=15, IP address: xx.xxx.xxx.xx, Language id
#1 mysqli_connect() called at [/includes/classes/db/mysql/query_factory.php:76]
#2 queryFactory->connect() called at [/admin/includes/init_includes/init_database.php:18]
#3 require(/admin/includes/init_includes/init_database.php) called at [/admin/includes/application_bootstrap.php:157]
#4 require_once(/admin/includes/application_bootstrap.php) called at [/admin/index.php:5]
--> PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /includes/classes/db/mysql/query_factory.php on line 76.
and
Code:
Request URI: /whitmanreg-folders-c-119_144_171/whitmanreg-coin-folder-4985-american-women-quarters-w-s-mint-20222025-p-4253.html, IP address: 114.119.132.171, Language id
#1 mysqli_connect() called at [/includes/classes/db/mysql/query_factory.php:76]
#2 queryFactory->connect() called at [/includes/init_includes/init_database.php:22]
#3 require(/includes/init_includes/init_database.php) called at [/includes/application_top.php:199]
#4 require(/includes/application_top.php) called at [/index.php:25]
--> PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /includes/classes/db/mysql/query_factory.php on line 76.
This error message does NOT say anything about those pages (sorry @dbltoe) and is NOT an indication of a 404. This message is indicating that your MySQL server can't be reached at the location you specified (this is your DB_SERVER setting in both configure.php files).
I'm assuming you have it set to 'localhost' - check with your hosting provider to see if they recommend using '127.0.0.1' instead or if the mysql server has it's own address.
There's also a chance there were server-side problems with mysql or the server's firewall blocked it or something like that - either way out of your control and something your host would need to look into if it continues to happen. I'd put my money on the firewall because the IP from your logs resolves to petalbot and if it started really hitting your site, your firewall probably kicked in and stopped it from abusing your server (which means you moved to a better hosting company).
As for the first error log, I'm not sure if the URL was redacted by you (in which case I'd suggest redacting it to MY_ADMIN instead of admin), but if you posted the actual URL from the logs, it could be just an attempt to discover vulnerable URLs... If it was you and you just redacted it, the 15s refresh time might have triggered something on the server to kick you out (mod_security for example).
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
Quote:
Originally Posted by
balihr
This error message does NOT say anything about those pages (sorry @dbltoe) and is NOT an indication of a 404. This message is indicating that your MySQL server can't be reached at the location you specified (this is your DB_SERVER setting in both configure.php files).
I'm assuming you have it set to 'localhost' - check with your hosting provider to see if they recommend using '127.0.0.1' instead or if the mysql server has it's own address.
There's also a chance there were server-side problems with mysql or the server's firewall blocked it or something like that - either way out of your control and something your host would need to look into if it continues to happen. I'd put my money on the firewall because the IP from your logs resolves to petalbot and if it started really hitting your site, your firewall probably kicked in and stopped it from abusing your server (which means you moved to a better hosting company).
As for the first error log, I'm not sure if the URL was redacted by you (in which case I'd suggest redacting it to MY_ADMIN instead of admin), but if you posted the actual URL from the logs, it could be just an attempt to discover vulnerable URLs... If it was you and you just redacted it, the 15s refresh time might have triggered something on the server to kick you out (mod_security for example).
Thank you, balihr. Yes, I did redact the url and will use My Admin in the future. I'll double check with the host, but that makes sense--there weren't any new errors overnight, so may have just been a one-off. Just wanted to make sure it wasn't something I had done or needed to change that was causing the issues.
@dbltoe--there was no 1920 silver dollar made, so you might be waiting awhile :P
Re: PHP Warning: mysqli_connect() -- Causes/Solution?
> mysqli_connect(): (HY000/2002): No such file or directory
As mentioned by balihr, the error message means the database cannot be reached / connected-to.
If it "was" working, then something's wrong with the database part of the server, controlled by the server admin (that's probably not you in this case, or you wouldn't be posting this).
If it "never was" working, then your DB_xxxxx settings in the configure.php files are probably wrong. The database server admin can give you the right credentials.