Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

James_Moore's avatar

PHP MYSQL Heroku

My Connection class which just returns a new instance of PDO is throwing an error that i have an invalid name when trying to connect to a JAWSDB on heroku. Works great when im connected locally. I've tested the database im trying to connect to with the same credentials in my config.php, I get the error

invalid data source name
public static function make($config)
    {
        try {
            return new PDO(
                $config['connection'] . ';dbname=' . $config['name'],
                $config['username'],
                $config['password'],
                $config['options']
            );
        } catch (PDOException $e) {
            die($e->getMessage());
        }
    }
0 likes
0 replies

Please or to participate in this conversation.