Is *AMP-stack web [design and] build is what you do? [Hacking WordPress!] You need a local dev environment. You need and want your dev environment to be a fuss-free, stable, reliable and long-term partner. The thing about the options I’ve used to now (macOS’ built-in Apache web server, MAMP Pro, VVV) is that they’ve failed on most of those requirements.
TLDR: Use Local by Flywheel for your virtual environment (and Migrate DB Pro plugin (and GIT, obviously (and rsync))).
If you’ve been doing this a while – on a Mac – you may have had experience running macOS’ built-in web server, MAMP Pro or even VVV. All have served me, better or worse, over the last 18 years or so.
The old hats
I loved the built-in macOS web server. It required minimal configuration – and coupled with virtualhost-sh and phpMyAdmin it covered all my needs. Learning to configure the built-in Apache webserver was a great grounding in how relatively easy it could be to set the platform from which to code and run a PHP website. Bolting on a MySQL database wasn’t that difficult either. But it seemed that with every system update everything got screwed up. It’s wasn’t ever too much trouble to get things working again but – as OS updates weren’t frequent enough to keep the set-up knowledge fresh – it was always more pain than it needed to be. Spending a day fixing things to get a two-minute job done on an old side-hustle is frustrating. In desperation, I turned to MAMP Pro. It was OK for a while but troubles with updates and deciphering corners of the UI and the frustrations came flooding back. Lastly, settled on VVV. It felt like going back to the good old days – back in the Terminal – but crashed out after a recent update. VVV is very clever but more smarts than I need and more high-maintenance than I want.
A bright new, clean environment
The beauty of Local by Flywheel is that it’s so simple. A 3-step start-up process and your site is up and running. By default, it’s a WordPress install but that doesn’t mean you can’t use it for any other PHP/MySQL use. The platform is Ngnix not Apache but, frankly, I don’t care. Nor should 95% of you. It’s also very tidy – your DB files are kept in the same master directory as you other site files. [Who’d have thunk it was possible.] It’s classy and free.
Syncing the DB
The other thing I’ve learnt is that a tool to simplify the process of syncronising your content (the MySQL DB) between live and local is a real time saver. While doing this manually is not too difficult – it requires care and attention plus occasional troubleshooting. I can’t recommend Migrate DB Pro highly enough. Honestly – of my favourite WP plugins – it’s the most favourite.
Tracking your footsteps
GIT. Specifically GitHub desktop app. You know why. If not, get learning already. Taking the time to check your own code and committing it into a safe repository is professionally essential. And good for your sanity.
Syncing the files
Rsync. You need to sync your files to and from the server, right? FTP is bad. sFTP is good. Rsync is better. Get your SSH access sorted (you needed that for sFTP anyway, right) and use both the remote server and your local machine to compare their files then securely update the compressed diffs in the direction you want. Efficient.