This guide assumes you have already successfully installed LAMPP.

Step 1 – install symfony

sudo wget https://get.symfony.com/cli/installer -O - | bash

Step 2 – move the installed files to make the installation global on your system:

mv /home/[your home folder]/.symfony/bin/symfony /usr/local/bin/symfony

Step 3 – check if it works. Enter:

symfony

Step 4 – Check if your system meets all requirements. Type:

symfony check:requirements

Step 5 – If you have a fresh install of LAMPP, you will need to install the SimpleXML extension. To do that, enter:

 sudo apt-get install php-xml

Step 6 – After that, restart the LAMPP services:

sudo ./lampp restart

Step 7 – final step. Check again:

symfony check:requirements

If needed, you can install the mbstring and intl extensions with the following commands:

sudo apt-get install php-mbstring
sudo apt-get install php-intl

To get PDO drivers for mySQL, type:

sudo apt-get install php-mysql

That’s it, you should be good to go now.



<?php 

function GetDbConnection(){ 

  $servername = "localhost"; 
  $username = "user"; 
  $password = "password"; 
  $dbname = "myDB"; 
  $conn = new mysqli($servername, $username, $password, $dbname); 
  if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
  } 
  return $conn;
}

function ListAllFromQuery($conn,$sql){
      
  $mArr = array();
  $result = $conn->query($sql);
  if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
      array_push($mArr, $row);
    }
  }
  return $mArr;
}


$conn = GetDbConnection();
$list =ListAllFromQuery($conn,"SELECT * FROM tblUser ORDER BY id;");
$output="";

for($i = 0; $i < count($list); $i++) { 
  $currentUser= $list[$i]; 
  foreach($currentUser as $key => $key_value) {
    $output.= $key . " = " . $key_value;
    $output.= "<br>";
  }
  $output.= "<hr>";
}

$conn->close();

echo $output;

?>