Choosing a local PHP development setup on Mojave
In this blog series, I take you through the steps I took to create my new setup: a blazingly fast and flexible setup with Apache, automatic DNS setup for .test domains, multiple PHP versions that I can easily switch between, Redis, Opcache, Image Magick, Blackfire and more. Links to the other blogs in this series are at the bottom.
My development setup part 1: Choosing a local PHP development setup on Mojave
So, with a new year come the proverbial new year resolutions. A resolution of mine was to finally get rid of all the different dev setups I had running on my local machine and set up a development environment that will last me for at least a year or two.
My old development setup was an accumulation of lecagy setups and ad hoc dev solutions, including Vagrant, Docker, MAMP Pro and an old Homebrew PHP install.
Vagrant and Docker are great, but way too slow for working locally. In my case this has to do primarily with synching of files between the VM and local file system. There are setups where you can tweak the synching and you can also develop inside the VM itself, but I find this tedious and error prone. MAMP Pro is actually not so bad, but a drag to re-setup the filepaths after upgrading to a newer PHP version, and it becomes excruciatingly slow when you have a lot of vhosts in place.
My choice for switching between multiple PHP versions on Mac
So what would the ideal dev server setup look like? Well,
- it has to run on my Macbook;
- be fast;
- include Redis, Opcache, Image Magick and Blackfire and for some versions;
- include some legacy non-standard extensions like Ioncube and XML-RPC.
And last but not least
- it needs to be really easy to setup vhosts;
- it needs to be easy to switch between PHP versions for legacy projects.
Laravel Valet would actually be a pretty good starting point for me if it ran on Apache instead of Nginx and wasn’t so automagically. As I said, I have a lot of lecagy projects, each with their own quirks and requirements. A lot of manual control would be nice.
I chose for native Apache/PHP/MySQL via Homebrew, with a few extras like dnsmasq and a script to let me easily switch between PHP versions. In the next blogs I'll take you through setting up this PHP development environment.
Blogs in this series:
- Choosing a local PHP development setup on Mojave
- Install and configure Apache 2 on Mojave with Homebrew
- Install and configure multiple PHP versions on Mojave with Homebrew
- Installing PHP extensions and services with PECL and Homebrew