Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2008
    Posts
    144
    Plugin Contributions
    0

    Default 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!

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,443
    Plugin Contributions
    11

    Default 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.

  3. #3
    Join Date
    Jan 2008
    Posts
    144
    Plugin Contributions
    0

    Default Re: PHP Warning: mysqli_connect() -- Causes/Solution?

    Quote Originally Posted by dbltoe View Post
    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?

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,443
    Plugin Contributions
    11

    Default 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.

  5. #5
    Join Date
    Jan 2008
    Posts
    144
    Plugin Contributions
    0

    Default Re: PHP Warning: mysqli_connect() -- Causes/Solution?

    Quote Originally Posted by dbltoe View Post
    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.

  6. #6
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,443
    Plugin Contributions
    11

    Default Re: PHP Warning: mysqli_connect() -- Causes/Solution?

    If I really helped, you can pay me with a 1920 silver dollar in any condition.

  7. #7
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: PHP Warning: mysqli_connect() -- Causes/Solution?

    Quote Originally Posted by mcqueeneycoins View Post
    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).

  8. #8
    Join Date
    Jan 2008
    Posts
    144
    Plugin Contributions
    0

    Default Re: PHP Warning: mysqli_connect() -- Causes/Solution?

    Quote Originally Posted by balihr View Post
    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

  9. #9
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default 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.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v154 mysqli_connect(): (HY000/2002): No such file or directory
    By adb34 in forum General Questions
    Replies: 24
    Last Post: 16 Aug 2020, 02:38 PM
  2. v156 v156b PHP Warning: mysqli_connect(): (HY000/2002): Connection refused
    By gwynwyffar in forum General Questions
    Replies: 3
    Last Post: 21 Aug 2019, 06:20 PM
  3. Replies: 7
    Last Post: 4 Jun 2018, 04:24 PM
  4. Replies: 30
    Last Post: 15 Apr 2016, 10:36 PM
  5. Replies: 10
    Last Post: 11 Feb 2016, 10:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR