MongoDB connectivity with PHP dropping after idle time

476 views Asked by At

I'm building a webapp with MongoDB/PHP, and everything's going great... except one thing.

My database connection is flaky. After X amount of time, when I refresh the page I get errors because queries are failing. I check mongod.exe and what I see is "Connection accepted from 127.0.0.1" - then I go back, refresh again, and everything's running all well and good.

What could be causing this? Database connectivity issues are something I never had to deal with in MySQL - but that's a whole different beast.

1

There are 1 answers

0
krob On BEST ANSWER

I would highly recommend you do your development with mongodb in a unix environment as they update the code the most often and you won't have to worry about strange bugs. Long ago i decided that doing dev in windows was much too inconvenient and moved my work environment to linux. If this sounds daunting, you might look into running a virtual machine with a local mount via samba such that you can run directly on a linux server on your local machine. Then you will have an environment similar to your production env. Hope this is helpful.