New DB error

32 views
Skip to first unread message

John3136

unread,
Dec 30, 2023, 10:23:09 PM12/30/23
to Xataface
My site has been up and running for years. It's now on 2.2.5. I went to do my "annual setup" (changing some data for 2024) and the whole site isn't working (as in I couldn't get in to do the update). No changes on my end. It's trying to use the mysqli driver, user/password/host all seem to be ok.
I just get  HTTP ERROR 500   and the message that the site can't handle the request.
I'm wondering if anyone has any clues ?

PHP error log says:
[31-Dec-2023 03:20:26 UTC] PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /home/mou16122/public_html/postals/xataface-2.2.5/xf/db/drivers/mysqli.php on line 4 [31-Dec-2023 03:20:26 UTC] PHP Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/mou16122/public_html/postals/xataface-2.2.5/xf/db/drivers/mysqli.php on line 17 [31-Dec-2023 03:20:26 UTC] PHP Fatal error: Uncaught Exception: Error connecting to the database: in /home/mou16122/public_html/postals/xataface-2.2.5/Dataface/Application.php:622 Stack trace: #0 /home/mou16122/public_html/postals/xataface-2.2.5/Dataface/Application.php(1104): Dataface_Application->__construct(Array) #1 /home/mou16122/public_html/postals/xataface-2.2.5/public-api.php(58): Dataface_Application::getInstance(NULL) #2 /home/mou16122/public_html/postals/index.php(10): df_init('/home/mou16122/...', 'xataface-2.2.5') #3 {main} thrown in /home/mou16122/public_html/postals/xataface-2.2.5/Dataface/Application.php on line 622

Steve Hannah

unread,
Dec 31, 2023, 12:27:00 AM12/31/23
to xata...@googlegroups.com
A not found error like that either means the file doesn't exist or it isn't accessible, due to permissions.

Check that the path exists.

Then check that the permissions make it accessible, and all parent directories are accessible.

Steve Hannah
Web Lite Solutions Corp.


--
You received this message because you are subscribed to the Google Groups "Xataface" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xataface+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xataface/67c07680-bd03-46ee-a015-ea58b7f096b1n%40googlegroups.com.

John3136

unread,
Jan 1, 2024, 2:02:45 AMJan 1
to Xataface
Thanks Steve. The file appears to be there - unless my hosting service is doing something funny with paths.  I already added some debug into Application.php and it looks like all of the expected variables are set and so on. Is there any "oddities" with PHP versions etc ? My host claims it is on 7.3.
I guess what I'm looking for is hints on "host end" things that could have changed because I haven't changed anything to do with the site from my end...

John3136

unread,
Jan 1, 2024, 2:21:49 AMJan 1
to Xataface
Ah ha - I might be 1 step closer... Cpanel says my home dir is /home1/mou16122, the error message says /home/mou16122 so it looks like PHP is looking somewhere different to cpanel...

I assume the error is coming from this line in Application.php:  require_once 'xf/db/drivers/'.basename($dbinfo['driver']).'.php';

I tried replacing that line (622 in Application.php) with a hardcoded absolute path but still no luck (with /home or /home1)
I'm currently back in index.php and wondering if there is something wrong with: df_init(__FILE__, 'xataface-2.2.5')->display();

John3136

unread,
Jan 1, 2024, 3:01:47 AMJan 1
to Xataface
False alarm. /home/... and /home1/... (and even /home2/...) say the file exists, so that is just some "hosting magic".
Line 4 of mysqli.php is return mysqli_connect($host, $user, $pass);

host user and pass are all set to expected values.

Looks like something to do with DB setup...

John3136

unread,
Jan 2, 2024, 11:02:15 PMJan 2
to Xataface
Hi Steve.
I'm still trying to figure this one out.
I get 3 errors. I think only this first one is a real problem.
[03-Jan-2024 03:37:30 UTC] PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in /home/mou16122/public_html/postals/xataface-2.2.5/xf/db/drivers/mysqli.php on line 4line 4 of code is in function xf_db_connect(): return mysqli_connect($host, $user, $pass);

$host, $user and $pass are all as I expect.

03-Jan-2024 03:37:30 UTC] PHP Warning: mysqli_error() expects exactly 1 parameter, 0 given in /home/mou16122/public_html/postals/xataface-2.2.5/xf/db/drivers/mysqli.php on line 17
line 17 is in xf_db_error() and reads: return mysqli_error();
It's in a check for a parameter being null. so I think this one is a red herring - it's an error in the error handling :-)
[03-Jan-2024 03:37:30 UTC] PHP Fatal error: Uncaught Exception: Error connecting to the database: in /home/mou16122/public_html/postals/xataface-2.2.5/Dataface/Application.php:623
line 623 is throwing the exception about the error connecting to the DB and calls xf_db_error() so this triggers the third error.

So it looks like this line is the one causing the first error:
$this->_db = xf_db_connect( $dbinfo['host'], $dbinfo['user'], $dbinfo['password'] );

As I said, the params inside xf_db_connect all look good, so it's something down inside mysqli_connect().

John3136

unread,
Jan 3, 2024, 11:59:37 AMJan 3
to Xataface
I just tried a simple "pure PHP" script (with no xataface) and that fails with  "No such file or directory"  too.
I've contacted my ISP for support.

At the moment it looks like using 127.0.0.1 instead of localhost is working (at least for my little pure PHP script) but I'll see what the ISP has to say...

John3136

unread,
Jan 23, 2024, 3:49:51 AMJan 23
to Xataface
Just to close the loop: I never heard back from my ISP but things are working properly using 127.0.0.1 instead of localhost.
Both in xataface and a couple of "pure PHP" scripts I've got that connect to the same DB.
Reply all
Reply to author
Forward
0 new messages