0

Okay so I have a wordpress website that I've been developing locally on my netbook. I want to be able to develop it both on my netbook and on my desktop so in order to ease the process and not have to reconfigure stuff each time I switch between the two, I decided to host my database remotely on my website, and then just configure the code for the local install to refer to the same database etc.

I've followed this guide:

https://coderwall.com/p/ck8v4a/remote-database-with-local-wordpress-instance

and it does not seem to be working for me. I have gone on my host's control panel (Dreamhost) and put my local IP as an allowable host, and I've set my wp-config files to map to my domain. And yet it still will not go through.

Any clues on what I'm doing wrong?

The only step in that link I didn't follow was: --Replace each instance of 'localhost' with your 'Server Name' in MAMP. (localhost is default)

Because I don't actually know what that means exactly? I don't know what it means to replace localhost with Server Name in MAMP...

  • First, test if your server is allowing remote connections first telnet DH_IP 3306 (via terminal), if it just hangs there then contact DreamHost about it. – Samuel Elh Sep 21 '17 at 23:01
  • note that doing this will be sloooow, you'd be much better off copying the data to a local setup. Doing a request to another server is one of the slowest things you can do, and now your site will do this for every query it makes. 1 request can take a second, and a page can easily have 20-30 queries, that's a 30 second page load – Tom J Nowell Sep 21 '17 at 23:14
  • @TomJNowell it will be slow? If it's just pulling down data from the database how slow can it be? The database is very small, less than 64mb total, and all the other files will be local etc. – David A. French Sep 22 '17 at 21:52
  • each time it does a query it has to go to the remote server, then the query runs, then the data has to be sent back. Even if the query took 1 nanosecond, and returned the smallest possible value, you've still got the back and forth time. Ping the remote server and you'll have a minimum time. This isn't a problem normally because databases are co-located with webhosts over high speed interlinks, or on the same machine, so it's a single hop away, or on the same CPU. This will be significantly slower than a local database – Tom J Nowell Sep 23 '17 at 3:30
  • Okay cool, thanks well I found a better solution! This thing called InstantWP allows me to run a local server off a USB drive. It's also WP only so it is less complicated and a bit easier to use than MAMP. instantwp.com – David A. French Sep 23 '17 at 4:34
0

What you are trying to do will not work as you local PCs will most likely get different IP addresses from time to time which will mean that you will have to reconfigure your server.

Your solution is much simpler.... just host the development site on your server, use the hosts file of your PCs to map whatever domain name you use for development to the IP of the server. You will also need some server side configuration to support that domain name, but since you use relatively respectable company, I assume it is something that you can do without having actual control of the domain, or use a subdomain of your site

  • Hey I'm sorry if this is kind of a newbie thing, but could I ask you some questions and break that down a little bit more. Are you saying that I should develop the website while it's on my Dreamhost server? What do you mean about using localhosts on my PC then? Sorry, I'm really new to any kind of backend. – David A. French Sep 22 '17 at 21:51
  • yes definitely develop it on your server, there is nothing that is easier to access from different computers then the actual internet. This I assume will also make it easier to share development stages with other people. As for setting the domain, sorry meant the hosts file en.wikipedia.org/wiki/Hosts_(file) which lets you have your local mapping of domain names to IP addresses – Mark Kaplun Sep 23 '17 at 5:10
  • Hey thanks @Mark Kaplun for responding. That's really helpful! – David A. French Sep 23 '17 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.