Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
PDO database connection error: SQLSTATE[08006] [7]
  • Hi... I'm getting this error when I try to connect with PDO:

    Fuel\Core\Database_Exception [ 7 ]:
    SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?

    Can anyone shed some light?

    Much appreciated!

  • HarroHarro
    Accepted Answer
    Assuming Postgres is running on localhost and listening to that port, are your credentials ok?
  • Thanks for your help... I'm a bit of a noob with Fuel.. would I have to work with a Postgres database? Can I setup with PDO and MySql? I can't find any notes on configuration requirements for fuel databases.

    Showing my 'green-ness', but what components would I need? At the moment, I've not touched anything to do with Postgres. 

    Really eager to try this framework! 
  • here is as far as  can see, the relevant part of my php config


    PDO supportenabled
    PDO drivers mysql, pgsql, sqlite


    PDO Driver for MySQLenabled
    Client API versionmysqlnd 5.0.10 - 20111026 - $Id: 2d8f599f49e5e8d2f5ba7112b5c444b3e2e48cdf $


    PDO Driver for PostgreSQLenabled
    PostgreSQL(libpq) Version8.3.3
    Module version1.0.2


    PDO Driver for SQLite 3.xenabled
    SQLite Library3.7.7.1
  • HarroHarro
    Accepted Answer
    I said Postgres because your error message said "on port 5432", which is the Postgres port.
    If you want to use MySQL, your PDO DSN is not correct.
  • thankyou! with a bit more digging I discovered the correct dsn. Rocking and rolling now.

    Much oblidged :o)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion