Can't connect my php code to sql server db


My site is hosting on windows server and I’m using php 7.3.4 and already have installed drivers. Using these two extensions in my php.ini file:

The code I’m using is bellow. I’ve tried so many ways but none of them was success.
Please can someone give me a hand

$serverName = ip_addr_of_server;
    $database = name_of_db;
    $uid = user_name;
    $pwd = password;
    try {
        $dbDB = new PDO(
        $dbDB->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

And the issue is what, you can’t connect?


Yes, I can’t connect to the server… doesn’t display data


Are you seeing any errors?


This shows it in the console -> Failed to load resource: the server responded with a status of 502 (Bad Gateway)