Reputation: 380
I'm having a little trouble with my dev environment for a CakePHP based project.
The thing is, CakePHP can connect in production, but if I run trough XAMPP on my PC, then throws me a
FATAL: no pg_hba.conf entry for host "myexternalip", user "dbuser", database "dbname", SSL off
but using the same parameters I can connect from my PC trough pgAdmin.
I've tried some googling tips that I've found like copy the libpq.dll
from c:\xampp\php
to c:\xampp\apache\bin
but, no luck, had checked pnp.ini
and extension=php_pdo_pgsql.dll
line is uncommented, had tried reboot apache several times but nothing changes
The project is hosted under heroku platform and my /app/config/database.php
looks like
public $production = array(
'datasource' => 'Database/Postgres',
'persistent' => false,
'host' => 'anywhere.at.amazonaws.com',
'login' => 'dbuser',
'password' => 'dbpwd',
'database' => 'dbname',
'encoding' => 'utf8',
);
here's the Stack Trace
- CORE\Cake\Model\Datasource\DboSource.php line 260 → Postgres->connect()
- CORE\Cake\Model\ConnectionManager.php line 105 → DboSource->__construct(array)
- CORE\Cake\Model\Model.php line 3613 → ConnectionManager::getDataSource(string)
- CORE\Cake\Model\Model.php line 1155 → Model->setDataSource(string)
- CORE\Cake\Model\Model.php line 3640 → Model->setSource(string)
- CORE\Cake\Model\Model.php line 827 → Model->getDataSource()
Can anyone give me another hint that could help?
Upvotes: 1
Views: 3032
Reputation: 380
After while I found a solution.
The problem is that's not straightforward.
As the Postgres server is hosted under heroku platform, the default configuration on server is require
ssl, so I've came across to this configuration:
public $production = array(
......
'sslmode' => 'require',
);
Now the error has changed to a sslmode value "require" invalid when ssl support is not compiled
then I've googled it and seems that at least under XAMPP v5.5.19, the libpq.dll
inside PHP folder wasn't compiled with ssl support
here's the question that helped me solve this problem: How to installPostgreSQL client library for PHP on Windows with SSL enabled
Seems that pgAdmin's libpq.dll
was compiled with ssl support, so that is the cause that I could connect through pgAdmin, but not with php
thanks for help folks!
Upvotes: 1