I would like to set up REST API, which can communicate with my database on my NAS. I made this simple PHP code for the database connection, and it works perfectly with Xampp on my computer.
<?php
$servername = "localhost:3307";
$username = "root";
$password = "MyRootPassword";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
However, when I upload this script to my web folder on my NAS, and when I want to load the file in the browser, I receive a HTTP Error 500
message.
(I have installed Web Station, and the server runs with PHP 7.3 and Apache HTTP Server 2.4. I also installed phpMyAdmin and MariaDB10.)
Why my code does not work on the NAS?