Member-only story

macOS: Built-in Web Server with several PHP versions and Xdebug

How to have several PHP versions installed in macOS, and use them with the built-in web server, having Xdebug available.

Luís Nóbrega

--

Photo by Markus Spiske on Unsplash

First step. Install PHP OSX.

What is this?

This is a binary package that installs several PHP versions in macOS.

This package installs the (usually) latest PHP 7.3/7.2/7.1/7.0/5.6/5.5/5.4/5.3 on OS X 10.6 (aka Snow Leopard), OS X 10.7 (aka Lion) and OS X 10.8 (aka Mountain Lion) and OS X 10.9 (aka Mavericks) and OS X 10.10 (aka Yosemite) and OS X 10.11 (aka El Capitan) and macOS 10.12 (aka Sierra) and macOS 10.13 (aka High Sierra) in /usr/local/php5. It installs many useful extensions (see below) and ini-settings and is what we at Liip use for our development. It’s especially suited for Symfony 2 development. It also provides a decent php.ini with all settings configured according to “Best Practices”.

Is it the best approach?

Yes and no. It depends.

The bundled PHP that comes with macOS comes in one specific version, so you cannot use another one.

You can also use phpbrew but I get some issues with that. Especially to have Xdebug working. But if it works for you…

--

--

No responses yet