Closed
Description
Symfony version(s) affected: 5.3.3
Description
Attempt to create unix socket connection using pdo_pgsql
and peer authentication results in fe_sendauth: no password supplied
exception.
How to reproduce
Configure PHP to use FPM, create a Linux user, PostgreSQL user, and PostgreSQL database all called testing
, and create a pool with user testing
.
Comment out database related settings in .env
and configure config/packages/doctrine.yaml
as follows:
doctrine:
dbal:
driver: pdo_pgsql
dbname: testing
server_version: 13
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
Execute the following:
[michael@devserver testing]$ bin/console doctrine:schema:validate
Mapping
-------
[OK] The mapping files are correct.
Database
--------
In AbstractPostgreSQLDriver.php line 88:
An exception occurred in driver: SQLSTATE[08006] [7] fe_sendauth: no password supplied
In Exception.php line 18:
SQLSTATE[08006] [7] fe_sendauth: no password supplied
In PDOConnection.php line 39:
SQLSTATE[08006] [7] fe_sendauth: no password supplied
doctrine:schema:validate [--em EM] [--skip-mapping] [--skip-sync]
[michael@devserver testing]$
Additional context
I know that PHP and PostgreSQL is configured correctly because the following PHP/Doctrine script independent of Symfony returns results without error using peer authentication without a username or password.
$config = Setup::createAnnotationMetadataConfiguration([__DIR__."/../src"], true, null, null, false);
$entityManager = EntityManager::create(['driver' => 'pdo_pgsql','dbname' => 'testing'], $config);
$pdo = $entityManager->getConnection();
$stmt = $pdo->query('SELECT * FROM company');
print_r($stmt->fetchAll());