0

It seems I have an issue with running my website in production and localhost in parallel due to some DB issue.

I run my PHP site on localhost using XAMPP, the website communicates with a database hosted on Godaddy. I get the following errors:

Warning: mysqli_query(): Premature end of data (mysqlnd_wireprotocol.c:942) in menu.inc.php on line 5 Warning: mysqli_query(): EOF packet 1 bytes shorter than expected in menu.inc.php on line 5 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, bool given in menu.inc.php on line 6

menu.inc.php line 5 and 6 are the first mysqli_query and mysqli_fetch_assoc commands on the site.

When those warnings appear, no data is retrieved from the DB.

However, If I go to GoDaddy CPanel and click on "repair database" and then connect from loaclhost - if works on localhost. But the production version of the site (also on GoDaddy) stops working ! The errors are not displayed, but the data is not retrieved and not displayed from DB.

It looks like only the first connection to the DB works and the second fails constantly ?

What might be the issue?

AlexB
  • 13
  • 2
  • 9
  • Well, it looks like the remote access isn't always very stable. If you are in dev mode on your local computer, perhaps you could clone your production database locally and work faster like that. But if you need to alter your production database then I understand the remote connection. If you have SSH, perhaps you could open a tunnel to connect to the database. It might be more stable. [You can do that easily with PuTTY](https://linuxize.com/post/mysql-ssh-tunnel/). – Patrick Janser Feb 13 '23 at 10:06

0 Answers0