PhpStorm, OS X, Macports and the Hunt for php-cgi

I love PhpStorm, but even though I've been using it forever, much of it remains a mystery. The latest problem I had was getting it to work with xdebug in the browser (again) after upgrading to version 8.  This turned out not to be a PhpStorm issue (see content/phpstorm-and-xdebug-browser-missing-instruction), but the time and effort it took to resolve revealed again that, often, the PhpStorm help file is all but helpful. 

PhpStorm and xdebug in the browser - the missing instruction

I spent the usual two lifetimes getting xdebug working (again) after upgrading to a new major version of phpStorm. Finally, I could debug a standalone php script in the IDE, but all attempts to do so from the browser were fruitless.

It turns out that phpStorm and the browser were using different versions of php.

Things to do (note that I am using Macports):