WP database connection error

Discussion in 'General' started by efex83, Feb 26, 2022.

  1. efex83

    efex83 New Member

    [VPS running Debian 10; LEMP stack; ISPConfig 3.2.7p1]

    After fixing issues installing ISPConfig3 from Autoinstaller script (wrong php version) I am unable to get a fresh WP install to connect to MariaDB

    So far this is the only nginx vhost and I triple checked and reset mysql database (empty) and user. phpmyadmin can connect - I also tried adding port to hostname in wp-config.php, to no avail.

    PHP versions 7.3, 7.4, 8.0, 8.1 are installed, I added them to ISPConfig as per tutorial, except default 7.3 which was showing since install.
    Only php-fpm and HHVM (no fastCGI) are available from pull down menu, although I am guessing this is expected/unrelated.
    Client does have suexec forced enabled.

    Testing connection with a php script returns
    Connection failed: SQLSTATE[HY000] [2002] No such file or directory 
    nginx error.log has some errors I think are the issue
    2022/02/26 16:13:45 [error] 1067#1067: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /usr/local/ispconfig/interface/lib/classes/db_mysql.inc.php on line 91PHP message: PHP Fatal error:  Uncaught Error: Call to a member function queryOneRecord() on bool in /usr/local/ispconfig/interface/lib/app.inc.php:169
    Stack trace:
    #0 /usr/local/ispconfig/interface/lib/app.inc.php(93): app->conf('interface', 'session_timeout')
    #1 /usr/local/ispconfig/interface/lib/app.inc.php(401): app->initialize_session()
    #2 /usr/local/ispconfig/interface/web/datalogstatus.php(34): require_once('/usr/local/ispc...')
    #3 {main}
      thrown in /usr/local/ispconfig/interface/lib/app.inc.php on l
    and later:

    2022/02/26 19:21:11 [error] 16289#16289: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli_query(): (HY000/1): Can't create/write to file '/tmp/#sql_869_0.MAI' (Errcode: 2 "No such file or directory") in /usr/local/ispconfig/interface/lib/classes/db_mysql.inc.php on line 300" while reading response header from upstream, client:, server: _, request: "GET /sites/web_vhost_domain_edit.php?id=1&type=domain HTTP/2.0", upstream: "fastcgi://unix:/var/lib/php7.3-fpm/ispconfig.sock:", host: "1xx.xx.xxx.xx:8080", referrer: "https://1xx.xx.xxx.xx:8080/index.php"
    There are also a few (unrelated?) ssl errors in webserver log
    SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share

    It seems to me I need to include some path somewhere but I can not figure this out.

    I am heading to bed now, but any help would be greatly appreciated, although I understand that this is (my) WP issue and not an ISPConfig bug
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Try using instead of localhost as mysql hostname. You might have activated chroot for websites and from within the chroot, you can access MySQL only by IP and not trough localhost (which is a file socket in /tmp which is unreachable from chroot).
    alva1 and efex83 like this.
  3. efex83

    efex83 New Member

    thank you very much

    should have checked that myself but wood > trees
  4. efex83

    efex83 New Member

    for the sake of completeness

    I did run in further issues getting the wp install to work. the installer did run but failed to populate anything but the _options table. (unable to write error) even with chroot php-fpm disabled.

    the decision to remove the db and db_user manually meant I ran into the "ISPConfig3 does no longer process job queue" problem. restarting the server mitigated this and created the new db

    I ended up re-running the wp install script with
    in wp-config.php instead of either localhost or and the install went through.

    Weirdly (and I seem to remember this problem from an install a few years back) after the install the fresh, newly chosen credentials did NOT work. I had to reset password via email.
  5. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    That in wp-config.php actually will detect the database server value automatically but in my mind providing the one suggested by @till should work too, though I haven't tried it of course.

Share This Page