Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:55:35+00:00 2026-06-18T08:55:35+00:00

Deployed a quick cloud server just to host a MongoDB to tinker with it

  • 0

Deployed a quick cloud server just to host a MongoDB to tinker with it out of curiosity. It’s installed and works. Made a test DB/Table like this:

 db.items.insert({ name: 'eggs', quantity: 10, price: 1.50 })
 db.items.insert({ name: 'bacon', quantity: 3, price: 3.50 })
 db.items.insert({ name: 'tomatoes', quantity: 30, price: 0.50 })

When I run db.items.find({}) all the items appear and all is well.

Now in PHP when I connect to that database from a different server I do this:

  // open connection to MongoDB server
  $conn = new Mongo('mongodb://theAdmin:Gold1234@165.225.130.252:27017');

  // access database
  $db = $conn->test;

  // access collection
  $collection = $db->items;

  // execute query
  // retrieve all documents
  $cursor = $collection->find();

  // iterate through the result set
  // print each document
  echo $cursor->count() . ' document(s) found. <br/>';  
  foreach ($cursor as $obj) {
    echo 'Name: ' . $obj['name'] . '<br/>';
    echo 'Quantity: ' . $obj['quantity'] . '<br/>';
    echo 'Price: ' . $obj['price'] . '<br/>';
    echo '<br/>';
  }

and I get this error:

Fatal error: Uncaught exception ‘MongoConnectionException’ with
message ‘Failed to connect to: 165.225.130.252:27017: Transport
endpoint is not connected’ in /home/moosex/public_html/info.php:4
Stack trace: #0 /home/moosex/public_html/info.php(4):
Mongo->__construct(‘mongodb://[theA…’) #1 {main} thrown in
/home/moosex/public_html/info.php on line 4

I’ve looked up and tried several different ways to connect and still can’t get it. How am I supposed to connect remotely?

BTW, that is the actual username password and address to that server(there’s nothing on there except for eggs bacon and tomatoes), if you can connect to it, god bless you lol.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:55:36+00:00Added an answer on June 18, 2026 at 8:55 am

    To be able to debug “random weirdness” like this, it is very useful to turn on the internal driver logging.
    The driver does whole lot of things behind the scenes, and can spit out all sort of important debug information.

    Add the following at the top of your script:

    <?php
    MongoLog::setLevel(MongoLog::ALL);
    MongoLog::setModule(MongoLog::ALL);
    ?>
    

    By default the logger will spew out “php error messages” (E_NOTICE/E_WARNING), if you have error_log enabled, make sure to check that file for the results.

    For your (slightly modified) connection string, I get the following results

    Notice: PARSE   INFO: Parsing mongodb://theAdmin:Gold1234@localhost:27027 in Command line code on line 1
    Notice: PARSE   INFO: - Found user 'theAdmin' and a password in Command line code on line 1
    Notice: PARSE   INFO: - Found node: localhost:27027 in Command line code on line 1
    Notice: PARSE   INFO: - Connection type: STANDALONE in Command line code on line 1
    Notice: PARSE   INFO: - No database name found for an authenticated connection. Using 'admin' as default database in Command line code on line 1
    Notice: CON     INFO: mongo_get_read_write_connection: finding a STANDALONE connection in Command line code on line 1
    Notice: CON     INFO: connection_create: creating new connection for localhost:27027 in Command line code on line 1
    Notice: CON     WARN: connection_create: error while creating connection for localhost:27027: Invalid argument in Command line code on line 1
    Notice: CON     WARN: Couldn't connect to 'localhost:27027': Invalid argument in Command line code on line 1
    

    I suspect a firewall issue at either end.. Can you connect to the server using the mongo shell?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick question. I deployed a website to Azure and it works fine.
Deployed a joynet hadoop smartmachine to tinker with HBase. It came with everything installed.
We need to determine a quick way for our web application deployed in a
I deployed a Symfony2 application on my server and I wanted to disable some
I deployed my MVC application in our IIS server. When I go to registration
I setup a quick web app using the Visual Studio Toolkit and deployed it
Check it out, in this quick video I toggle between my localhost copy and
I have a SQL Server CE Database file that gets re-deployed every time I
I deployed a Grails application that I built (first application I've made) that starts
I deployed my Django app to a remote server, but tastypie doesn't recognize a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.