PHP 8.2 locally on apple mac M3 throws 503 with a simple pg_sql pdo connection string

34 Views Asked by At

This simple connection string test causes 503 error

try{
    $dsn = "pgsql:host=127.0.0.1;port=5432;dbname=skeleton;";
//    $dsn = "mysql:host=127.0.0.1;port=3306;dbname=nis;";
    // make a database connection
    $pdo = new PDO($dsn, 'symfony', 'symfony', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);

    if ($pdo) {
        echo "Connected to the skeleton database successfully!";
    }
}
catch(PDOException $ex){
    var_dump($ex);
    die(json_encode(array('outcome' => false, 'message' => 'Unable to connect')));
}

I've got two brew systems, one for the apple silicon chip services and one for the intel chip services (with rosetta)

PHP is installed with the intel chip brew, postgresql@13 also but every test throws a 503 error

The simple connection test with mysql works even if mariadb is installed with the other brew.

I've tried everything that i could, i can connect to psql in command line but with php, i can't, the PDO is correctly enabled (by default BTW)

0

There are 0 best solutions below