Skip to content

Connection Fail #22

Closed
Closed
@felixcheruiyot

Description

@felixcheruiyot

I am trying to use Laravel-MongoDB in Laravel 4 but I run into this error

MongoClient::__construct(): php_network_getaddresses: getaddrinfo failed: Name or service not known 

From Laravel trace tool, this file is highlighted [/var/www/archels/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php] line 30-39

// Store configuration
$this->config = $config;
// Check for connection options
$options = array_get($config, 'options', array());
// Create connection
$this->connection = new MongoClient($this->getDsn($config), $options);
// Select database

This is how I do my connection

'mongodb' => array( 'driver' => 'mongodb', 'host' => '127.0.0.1', 'port' => 27017, 'username' => 'myusername', 'password' => 'mypassword', 'database' => 'mydb' ),

Note: I followed this tutorial for php-driver installation and RockDB.

Any Idea on why this is happening? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions