php
php copied to clipboard
upgrade pdo_pgsql to support SNI
upgrade pdo_pgsql to support SNI
Hi, I use 8.1 & 8.2 and try to connect pgsql( provided by neon.tech) with laravel+vercel [email protected] - PHP 8.2.x (https://example-php-8-2.vercel.app/) [email protected] - PHP 8.1.x (https://example-php-8-1.vercel.app/)
But I met blow problems:
SQLSTATE[08006] [7] ERROR: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=endpoint%3D<endpoint-id>'. See more at https://neon.tech/sni
ERROR: connection is insecure (try using `sslmode=require`) (Connection: pgsql, SQL: select * from "users" where "email" =
https://neon.tech/docs/connect/connectivity-issues
I tried config/database.config each options, not work
'sslmode' => 'verify-full',//prefer/require
I think we need update pdo_pgsql > 10.21
my local is pdo_pgsql 15.1 and works.
thanks.
I am also facing that issue too, we have to update that in vercel php.
Related: https://github.com/vercel/storage/issues/120
Hi. Do you know which exactly libraries needs to be upgraded?
pgsql Liv I think so
Same here. Is there any way to upgrade the libpq?
The [email protected] - PHP 8.2.x (https://example-php-8-2.vercel.app/) shows the version of libpq is 10.21, which is unsupported now.
The latest version is 16 and according to neon.tech (Vercel's Postgres provider), SNI support was added to the libpq in version 14, which was released in September 2021.
I ran into a similar problem today. I make connection via pg_connect and to solve the problem I added options='endpoint=ep-shrill-disk-*****'
The connection worked successfully $connect_data = "host=ep-shrill-disk-.eu-central-1.aws.neon.tech port=5432 dbname=php-neon user=daniil.bazhenov password= sslmode=require options='endpoint=ep-shrill-disk-*****'";
$db_connect = pg_connect($connect_data);
@dbazhenov I was having the same issue in laravel vercel, How to do this "options='endpoint=ep-shrill-disk-*****'" in laravel, i tried but not working
If you're using Laravel, you can use this package https://github.com/braumye/laravel-vercel-postgres that add the endpoint to the options of the dsn and it worked for me.
Neon document: https://neon.tech/docs/connect/connection-errors#b-use-libpq-keyvalue-syntax-in-the-database-field
I encountered the same issue during deployment today and hope that Vercel can promptly upgrade pdo_pgsql to support SNI.
I faced same error today. I think it is because of pgsql lib.
hi i have a same error, i trying to use laravel with postgres, but when i access database to get data i have this error: "could not find driver (Connection: pgsql, SQL: select * from "users" where "email" = [email protected] limit 1)". Does anyone know how to solve this?
Hi, I will prepare PHP update with postgres14. I hope it will solve your troubles.
Hello, The official work-around that seems to work is to append the endpoint_ID with the password in the connection string like
DATABASE_URL=postgres://dbuser:<endpoint=<endpoint_id>>;<your_password>@ep-broad-snowflake-sdexc.il-central-1.aws.neon.tech/neondb?pgbouncer=true&connect_timeout=10
So basically, add this --> endpoint=<endpoint_id>;
(including the comma)
Alternatively, if you are using database connection parameters, you can use the following
...
DB_PASSWORD='<endpoint=<endpoint_id>>;<your_password>'
In our case, the endpoint ID is --> ep-broad-snowflake-sdexc
(as seen in the connection URL above)
Hope this helps.
@zone-connect Thenk you kind sir
If you're using Laravel, you can use this package https://github.com/braumye/laravel-vercel-postgres that add the endpoint to the options of the dsn and it worked for me.
Neon document: https://neon.tech/docs/connect/connection-errors#b-use-libpq-keyvalue-syntax-in-the-database-field
Connect with success using this package, but now I have this error:
INFO Preparing database.
Creating migration table .............................................................................................................. 425ms DONE
INFO Running migrations.
2014_10_12_000000_create_users_table .................................................................................................. 704ms DONE
2014_10_12_100000_create_password_reset_tokens_table .................................................................................. 844ms FAIL
Illuminate\Database\QueryException
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block (Connection: pgsql, SQL: alter table "password_reset_tokens" add primary key ("email"))
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:822
818▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
819▕ );
820▕ }
821▕
➜ 822▕ throw new QueryException(
823▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
824▕ );
825▕ }
826▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connection.php:580
PDOException::("SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block")
2 vendor\laravel\framework\src\Illuminate\Database\Connection.php:580
PDOStatement::execute()