2

I am trying to connect to another VM (192.168.16.27) from 192.168.16.28 to get Data out of the MariaDB Database (joomla). So my Code is:

$link = mysqli_connect("192.168.16.27", "user", "userpassword", "joomladb");

It works if I insert localhost instead of the IP adress and host it from the same server. I as well changed the bind_adress from both servers from 127.0.0.1 to 0.0.0.0 and expanded the max_allowed_packet to 512M.

I´m just trying to SELECT a single ID from one table of the joomladb.

But I only get the error message - MySQL Server has gone away - and a blank white sheet

So my question is: Does anyone have another idea what could go wrong in here? (Someone from Stack Overflow lead me to this site.) Thanks for any advice!

EDIT:

I´ve tried to add the Port as well:

$link = mysqli_connect("192.168.16.27:3306", "user", "userpassword", "joomladb");

$link = mysqli_connect("192.168.16.27:3307", "user", "userpassword", "joomladb");

nothing changed.

EDITEDIT:

more code:

$link = mysqli_connect("192.168.16.27", "user", "userpassword", "joomladb");
$sql_news = "SELECT introtext FROM jos_content WHERE id = '543'";
$result_query = mysqli_query($link, $sql_news);

if (mysqli_num_rows($result_query)) {
  while ($row = mysqli_fetch_assoc($result_query)) 
  {
     $news = $row["introtext"];
  }
}
else 
{
  echo "0 results";
}
1
  • Welcome to JSE and thank you for your question. Please take our tour to familiarise yourself with this Stack Exchange community.
    – pe7er
    Apr 7 at 13:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.