Is there a workaround to include a connect.php file if the server does not accept external connections?

If the server does not accept external connections, you can include the contents of the connect.php file directly in your main PHP file. This way, you avoid the need for an external connection and ensure that the database connection information is still secure within your server environment.

<?php
// Database connection details
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}