Homebrew changed how it handles PHP. A brew update completely broke my dev setup. This is how I fixed it.

My homebrew setup was too fucked to save. I started by backing up mysql (hello mysqldump --all-databases) and a few other important files in /usr/local that seemed important. Then paved it clean to start over.

  1. Download and install homebrew.
  2. brew install php@5.6 (and a bunch of other stuff like npm, yarn, bower, etc).
  3. brew link --force --overwrite php@5.6
  4. brew install mysql because I have an older Mac that can’t run the most recent PHP. Configuring it was a bit of a pain.
  5. brew services start mysql
  6. brew services start php@5.6 (this might be unnecessary)
  7. Mangle the apache configuration files (below).
  8. emacs /usr/local/etc/php/5.6/php.ini
  9. brew install imagemagick pkg-config
  10. pecl install imagick

That was enough for my setup. `pecl` managed to install in the right place and configure PHP to find it. Homebrew’s new PHP includes the rest of the dependencies I need. So yay!

Apache Config:

# Get the homebrew stuff up.
LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/
<FilesMatch .php$>
 SetHandler application/x-httpd-php