Well, this looks good to me, it just refuses to build a PDO connection on
your local DB.
As you can see, it tries to do something like
PDO->__construct('pgsql:host=loca...', 'postgres', '', Array)
in PDOConnection.php:36.
I suggest you to instantiate a PDO connection manually and check what the
problem is. You are nearing the problem, it is just a matter of discovering
the parameters you should use to connect to your pgsql.
Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com
On 24 September 2012 16:45, gzamboni [via Zend Framework Community] <
[email protected]> wrote:
>
> finally i achieve to get the dump of the object :
>
> object(Doctrine\DBAL\Connection)#215 (14) { ["_conn":protected]=> NULL
> ["_config":protected]=> object(Doctrine\ORM\Configuration)#214 (1) {
> ["_attributes":protected]=> array(9) { ["autoGenerateProxyClasses"]=>
> bool(true) ["proxyDir"]=> string(28) "data/DoctrineORMModule/Proxy"
> ["proxyNamespace"]=> string(23) "DoctrineORMModule\Proxy"
> ["entityNamespaces"]=> array(0) { } ["metadataCacheImpl"]=>
> object(Doctrine\Common\Cache\ArrayCache)#216 (3) {
> ["data":"Doctrine\Common\Cache\ArrayCache":private]=> array(0) { }
> ["namespace":"Doctrine\Common\Cache\CacheProvider":private]=> string(0) ""
> ["namespaceVersion":"Doctrine\Common\Cache\CacheProvider":private]=> NULL }
> ["queryCacheImpl"]=> object(Doctrine\Common\Cache\ArrayCache)#216 (3) {
> ["data":"Doctrine\Common\Cache\ArrayCache":private]=> array(0) { }
> ["namespace":"Doctrine\Common\Cache\CacheProvider":private]=> string(0) ""
> ["namespaceVersion":"Doctrine\Common\Cache\CacheProvider":private]=> NULL }
> ["metadataDriverImpl"]=> object(Doctrine\ORM\Mapping\Driver\DriverChain)#217
> (2) {
> ["defaultDriver":"Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain":private]=>
> NULL
> ["drivers":"Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain":private]=>
> array(1) { ["Album\Entity"]=>
> object(Doctrine\ORM\Mapping\Driver\AnnotationDriver)#227 (5) {
> ["entityAnnotationClasses":protected]=> array(2) {
> ["Doctrine\ORM\Mapping\Entity"]=> int(1)
> ["Doctrine\ORM\Mapping\MappedSuperclass"]=> int(2) } ["reader":protected]=>
> object(Doctrine\Common\Annotations\CachedReader)#225 (4) {
> ["delegate":"Doctrine\Common\Annotations\CachedReader":private]=>
> object(Doctrine\Common\Annotations\IndexedReader)#226 (1) {
> ["delegate":"Doctrine\Common\Annotations\IndexedReader":private]=>
> object(Doctrine\Common\Annotations\AnnotationReader)#219 (5) {
> ["parser":"Doctrine\Common\Annotations\AnnotationReader":private]=>
> object(Doctrine\Common\Annotations\DocParser)#220 (9) {
> ["lexer":"Doctrine\Common\Annotations\DocParser":private]=>
> object(Doctrine\Common\Annotations\DocLexer)#221 (7) { ["noCase":protected]=>
> array(9) { ["@"]=> int(101) [","]=> int(104) ["("]=> int(109) [")"]=>
> int(103) ["{"]=> int(108) ["}"]=> int(102) ["="]=> int(105) [":"]=> int(112)
> ["\"]=> int(107) } ["withCase":protected]=> array(3) { ["true"]=> int(110)
> ["false"]=> int(106) ["null"]=> int(111) }
> ["tokens":"Doctrine\Common\Lexer":private]=> array(0) { }
> ["position":"Doctrine\Common\Lexer":private]=> int(0)
> ["peek":"Doctrine\Common\Lexer":private]=> int(0) ["lookahead"]=> NULL
> ["token"]=> NULL }
> ["target":"Doctrine\Common\Annotations\DocParser":private]=> NULL
> ["isNestedAnnotation":"Doctrine\Common\Annotations\DocParser":private]=>
> bool(false) ["imports":"Doctrine\Common\Annotations\DocParser":private]=>
> array(0) { }
> ["classExists":"Doctrine\Common\Annotations\DocParser":private]=> array(0) {
> }
> ["ignoreNotImportedAnnotations":"Doctrine\Common\Annotations\DocParser":private]=>
> bool(false) ["namespaces":"Doctrine\Common\Annotations\DocParser":private]=>
> array(0) { }
> ["ignoredAnnotationNames":"Doctrine\Common\Annotations\DocParser":private]=>
> array(0) { } ["context":"Doctrine\Common\Annotations\DocParser":private]=>
> string(0) "" }
> ["preParser":"Doctrine\Common\Annotations\AnnotationReader":private]=>
> object(Doctrine\Common\Annotations\DocParser)#222 (9) {
> ["lexer":"Doctrine\Common\Annotations\DocParser":private]=>
> object(Doctrine\Common\Annotations\DocLexer)#223 (7) { ["noCase":protected]=>
> array(9) { ["@"]=> int(101) [","]=> int(104) ["("]=> int(109) [")"]=>
> int(103) ["{"]=> int(108) ["}"]=> int(102) ["="]=> int(105) [":"]=> int(112)
> ["\"]=> int(107) } ["withCase":protected]=> array(3) { ["true"]=> int(110)
> ["false"]=> int(106) ["null"]=> int(111) }
> ["tokens":"Doctrine\Common\Lexer":private]=> array(0) { }
> ["position":"Doctrine\Common\Lexer":private]=> int(0)
> ["peek":"Doctrine\Common\Lexer":private]=> int(0) ["lookahead"]=> NULL
> ["token"]=> NULL }
> ["target":"Doctrine\Common\Annotations\DocParser":private]=> NULL
> ["isNestedAnnotation":"Doctrine\Common\Annotations\DocParser":private]=>
> bool(false) ["imports":"Doctrine\Common\Annotations\DocParser":private]=>
> array(1) { ["ignoreannotation"]=> string(55)
> "Doctrine\Common\Annotations\Annotation\IgnoreAnnotation" }
> ["classExists":"Doctrine\Common\Annotations\DocParser":private]=> array(0) {
> }
> ["ignoreNotImportedAnnotations":"Doctrine\Common\Annotations\DocParser":private]=>
> bool(true) ["namespaces":"Doctrine\Common\Annotations\DocParser":private]=>
> array(0) { }
> ["ignoredAnnotationNames":"Doctrine\Common\Annotations\DocParser":private]=>
> array(0) { } ["context":"Doctrine\Common\Annotations\DocParser":private]=>
> string(0) "" }
> ["phpParser":"Doctrine\Common\Annotations\AnnotationReader":private]=>
> object(Doctrine\Common\Annotations\PhpParser)#224 (0) { }
> ["imports":"Doctrine\Common\Annotations\AnnotationReader":private]=> array(0)
> { }
> ["ignoredAnnotationNames":"Doctrine\Common\Annotations\AnnotationReader":private]=>
> array(0) { } } }
> ["cache":"Doctrine\Common\Annotations\CachedReader":private]=>
> object(Doctrine\Common\Cache\ArrayCache)#216 (3) {
> ["data":"Doctrine\Common\Cache\ArrayCache":private]=> array(0) { }
> ["namespace":"Doctrine\Common\Cache\CacheProvider":private]=> string(0) ""
> ["namespaceVersion":"Doctrine\Common\Cache\CacheProvider":private]=> NULL }
> ["debug":"Doctrine\Common\Annotations\CachedReader":private]=> bool(false)
> ["loadedAnnotations":"Doctrine\Common\Annotations\CachedReader":private]=>
> NULL } ["paths":protected]=> array(1) { [0]=> string(55)
> "/var/www/square/module/Album/config/../src/Album/Entity" }
> ["fileExtension":protected]=> string(4) ".php" ["classNames":protected]=>
> NULL } } } ["resultCacheImpl"]=> object(Doctrine\Common\Cache\ArrayCache)#216
> (3) { ["data":"Doctrine\Common\Cache\ArrayCache":private]=> array(0) { }
> ["namespace":"Doctrine\Common\Cache\CacheProvider":private]=> string(0) ""
> ["namespaceVersion":"Doctrine\Common\Cache\CacheProvider":private]=> NULL }
> ["sqlLogger"]=> NULL } } ["_eventManager":protected]=>
> object(Doctrine\Common\EventManager)#199 (1) {
> ["_listeners":"Doctrine\Common\EventManager":private]=> array(1) {
> ["loadClassMetadata"]=> array(1) { ["0000000063092d7400000000edcf1bb4"]=>
> object(Doctrine\ORM\Tools\ResolveTargetEntityListener)#198 (1) {
> ["resolveTargetEntities":"Doctrine\ORM\Tools\ResolveTargetEntityListener":private]=>
> array(0) { } } } } } ["_expr":protected]=>
> object(Doctrine\DBAL\Query\Expression\ExpressionBuilder)#218 (1) {
> ["connection":"Doctrine\DBAL\Query\Expression\ExpressionBuilder":private]=>
> *RECURSION* } ["_isConnected":"Doctrine\DBAL\Connection":private]=>
> bool(false) ["_transactionNestingLevel":"Doctrine\DBAL\Connection":private]=>
> int(0) ["_transactionIsolationLevel":"Doctrine\DBAL\Connection":private]=>
> int(2)
> ["_nestTransactionsWithSavepoints":"Doctrine\DBAL\Connection":private]=> NULL
> ["_params":"Doctrine\DBAL\Connection":private]=> array(8) { ["driverClass"]=>
> string(36) "Doctrine\DBAL\Driver\PDOPgSql\Driver" ["wrapperClass"]=> NULL
> ["pdo"]=> NULL ["host"]=> string(9) "localhost" ["port"]=> string(4) "5432"
> ["user"]=> string(8) "postgres" ["password"]=> string(0) "" ["dbname"]=>
> string(6) "square" } ["_platform":protected]=>
> object(Doctrine\DBAL\Platforms\PostgreSqlPlatform)#228 (4) {
> ["doctrineTypeMapping":protected]=> NULL ["doctrineTypeComments":protected]=>
> NULL ["_eventManager":protected]=> object(Doctrine\Common\EventManager)#199
> (1) { ["_listeners":"Doctrine\Common\EventManager":private]=> array(1) {
> ["loadClassMetadata"]=> array(1) { ["0000000063092d7400000000edcf1bb4"]=>
> object(Doctrine\ORM\Tools\ResolveTargetEntityListener)#198 (1) {
> ["resolveTargetEntities":"Doctrine\ORM\Tools\ResolveTargetEntityListener":private]=>
> array(0) { } } } } } ["_keywords":protected]=> NULL }
> ["_schemaManager":protected]=> NULL ["_driver":protected]=>
> object(Doctrine\DBAL\Driver\PDOPgSql\Driver)#213 (0) { }
> ["_isRollbackOnly":"Doctrine\DBAL\Connection":private]=> bool(false)
> ["_defaultFetchMode":"Doctrine\DBAL\Connection":private]=> int(2)}
>
>
> and if i dont try i retrieve the object i see this:
>
> Additional information:
> PDOException
> File:
> /var/www/square/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:36
> Message:
> SQLSTATE[08006] [7] could not connect to server: Permission denied
> Is the server running on host "localhost" and accepting
> TCP/IP connections on port 5432?
> could not connect to server: Permission denied
> Is the server running on host "localhost" and accepting
> TCP/IP connections on port 5432?
> Stack trace:
> #0
> /var/www/square/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(36):
> PDO->__construct('pgsql:host=loca...', 'postgres', '', Array)
> #1
> /var/www/square/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php(26):
> Doctrine\DBAL\Driver\PDOConnection->__construct('pgsql:host=loca...',
> 'postgres', '', Array)
> #2
> /var/www/square/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(350):
> Doctrine\DBAL\Driver\PDOPgSql\Driver->connect(Array, 'postgres', '', Array)
> #3
> /var/www/square/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(627):
> Doctrine\DBAL\Connection->connect()
> #4
> /var/www/square/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(843):
> Doctrine\DBAL\Connection->executeQuery('SELECT t0.id AS...', Array, Array)
> #5
> /var/www/square/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(156):
> Doctrine\ORM\Persisters\BasicEntityPersister->loadAll(Array, NULL, NULL,
> NULL)
> #6
> /var/www/square/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(140):
> Doctrine\ORM\EntityRepository->findBy(Array)
> #7 /var/www/square/module/Album/src/Album/Controller/AlbumController.php(66):
> Doctrine\ORM\EntityRepository->findAll()
> #8
> /var/www/square/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(87):
> Album\Controller\AlbumController->indexAction()
> #9 [internal function]:
> Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
> #10
> /var/www/square/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
> call_user_func(Array, Object(Zend\Mvc\MvcEvent))
> #11
> /var/www/square/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(208):
> Zend\EventManager\EventManager->triggerListeners('dispatch',
> Object(Zend\Mvc\MvcEvent), Object(Closure))
> #12
> /var/www/square/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(108):
> Zend\EventManager\EventManager->trigger('dispatch',
> Object(Zend\Mvc\MvcEvent), Object(Closure))
> #13
> /var/www/square/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114):
>
> Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request),
> Object(Zend\Http\PhpEnvironment\Response))
> #14 [internal function]:
> Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
> #15
> /var/www/square/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
> call_user_func(Array, Object(Zend\Mvc\MvcEvent))
> #16
> /var/www/square/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(208):
> Zend\EventManager\EventManager->triggerListeners('dispatch',
> Object(Zend\Mvc\MvcEvent), Object(Closure))
> #17
> /var/www/square/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(297):
> Zend\EventManager\EventManager->trigger('dispatch',
> Object(Zend\Mvc\MvcEvent), Object(Closure))
> #18 /var/www/square/public/index.php(12): Zend\Mvc\Application->run()
> #19 {main}
>
>
> i saw it says it cannot find the db on localhost but, i have on localhost
> and i made a script that can be go through port 5432.
> Wait for help, thx again, sry for my lack of knowledge
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Postgres-configuration-with-doctrine-ZF2-tp4657079p4657096.html
> To unsubscribe from Zend Framework Community, click
> here<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=634137&code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4>
> .
> NAML<http://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Postgres-configuration-with-doctrine-ZF2-tp4657079p4657097.html
Sent from the Zend Framework mailing list archive at Nabble.com.