Mac Docker PHP Xdebug and Api-platform and PHPStorm.

Having trying to debug without xdebug felt like my hands were being tied behind my back.

Took a while, but my friend Bart was able to help me get this up and running, after lots of trouble shooting.

The way it seems, api-platform sets docker up in distinct containers:

Wanting to debug in xdebug, on a mac, inside a docker container wasn’t as straight forward as I would have thought it could be.

Docker/alpine is running nginx. Nginx proxies the calls for php-fpm.

The meat and potatoes of getting this setup:

file: api/Dockerfile

	pecl install \
		xdebug-${XDEBUG_VERSION} \
	; \
	docker-php-ext-enable \
		apcu \
		opcache \
		xdebug \
	; \

file: api/docker/php/php.ini

xdebug.idekey = "PHPSTORM"
xdebug.remote_host = ""

on your host machine run this on the command line:

$> sudo ifconfig lo0 alias

file: api/.env


Run/Debug Configuration:

That should do it… change PHPSTORM, to your ide key… but PHPSTORM is pretty standard for PhpStorm.

Remember to rebuild your container… as sometimes (why I don’t know) changes don’t take effect until it’s rebuilt.

If you’re having troubles, look at “phpinfo();” or “$> php -v”. Check:

  1. xdebug is enabled as a plugin
  2. environment variable: PHP_IDE_CONFIG, is indeed set… and without quotes.
  3. your absolute path on the server is correct

Hoped this helps others… as it wasn’t straight forward at all for me.

todo for this post: fix links for dropbox images.

Mac OSx High Sierra Homebrew switching between PHP@7.2 and PHP@5.6

Homebrew recently deprecated the repo as of March 31st, 2018.

So, how do you install PHP@5.6, and/or PHP@7.2 (or @7.0, or @7.1, these are untested, but I assume will work).

I work on some legacy sites, that require switching between the versions.


So, lets run through this… I’m going to assume you cleaned up the old version of PHP.

# clean up the old PHPs.
$> brew uninstall uninstall php72 php56

# append whatever options you may want. maybe –with-httpd
$> brew install php@7.2
$> brew unlink php@7.2 –force
$> brew install php@5.6
$> brew unlink php@5.6 –force


modify you’re httpd conf, to accept your desired version of PHP you want to run.


#LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/
LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/

If you run
$> php -v
it will fail.

$> php -v
-bash: /usr/local/bin/php: No such file or directory

This is because we unlinked both versions.

Say we want to use PHP version 5.6

$> brew link php@5.6 --force

Now when we php 5.6 as our cli PHP.
$> php -v
PHP 5.6.35 (cli) (built: Mar 31 2018 20:21:31)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

If you want php5 to run in apache.
ensure that php5 module is enabled in httpd.conf, and restart apache/httpd deamon.
$> sudo brew services httpd restart

NOTE: You need to run with sudo, if your http port is below 1000, or was that 1024… I forget.



If you want to switch back to php@7.2,

  1. unlink,
  2. change httpd.conf to use php7.2
  3. restart apache



Also, if you want to install xdebug,or memcached use pecl.

for PHP@5.6

$> pecl install xdebug-2.2.0

for PHP@7.2

$> pecl install xdebug


If you want memcached:

with PHP@5.6 (as of writing this, 2018-04-10)
brew install libmemcached
brew install pkg-config<
pecl install memcached-2.2.0

use: /usr/local/Cellar/libmemcached/1.0.18_2 for the memcached location.

Autel maxitpms pad on a mac? Yes, and no.

Can you run Autel MaxiTPMS Pad on a mac? Directly, no. Through virtual box, yes.

  1. Install virtualbox and Oracle VM VirtualBox Extension Pack, both from:
  2. Download the windows 10 trial image/iso/dmdk/ovf, which is free, from Microsoft. linke:
  3. After you’ve unzipped the image
  4. Double click the ovf to launch it with virtualbox.
  5. Ensure you add USB support when you setup the image.
  6. you may need specify which device, so that the image can recognize the TPMS pad.
  7. Download the latest MaxiTPMS pad software from: Diagnostic & Service Tool/533.jhtml
  8. Run and install as normal windows app.
  9. It’ll self update probably, once or twice. Ask you to reboot your image.
  10. Once the reboot happens, you can then finally update your MaxiTPMS pad.


And you’re done.



Raspberry PI for the logic. it’ll have it’s own 802.11n USB adapter


Project Ideas:

The promise, is to use an ESP8266, to control a bunch of relays.  Using the Raspberry PI for logic control.

  1. DIY 1 plug relay – HRV control.
    1. Check to see (via the NEST) if the humidity is high or low, run the HRV
    2. Intermittent running of HRV when
      1. Run HRV if not during peak/high energy rates…
  2. DIY 8 plug power bar, timer on/off control.
    1. Build your own power bar, that is WIFI controlled.
    2. ESP8266 has several GPIO pins.  Wire them up to relays, to get some relay action going.
      1. Printer on demand.
      2. Scanner on demand.
      3. VPN hardware on during weekdays work hours.
      4. Monitors (5watts on standby).
      5. USB power on standby.
      6. Thunderbolt belkin on standby when not in use.
      7. USB External HDs???
  3. DIY 8 plug power bar, timer on/off control.
    1. TV
    2. Set top box
    3. blue-ray player
    4. PS4/XBOX etc…


Watts Ander-Lign Compression fittings

I was looking around, and couldn’t find anything.


Lots of people on home-depot felt that these things were not the greatest.

Problems that people ran into, where reusing the old tubes.  These are meant for a complete system.  It’s color coded for ease.

I was using the 1/4″ tubing so that it’ll fit my under the sink reverse osmosis filtration system.  I needed to connect the tank line to the fridge/icemaker.

I went and bought a T, and another coupler.

I could not find any instructions directly for the watts Ander-Lign compression fittings/coupler.  This is what I found to work (with no leaks):

  1. Do not disassemble the unit.
  2. Finger tighten the assembly
  3. Cut the plastic tube flush
  4. Insert the tube directly into the brass fitting, while the unit is STILL assembled.  Push until it doesn’t go any further.
  5. Using a pair of wrenches, do a 3/4 (three quarter) turn of the nut to compress the brass sleeve.

Items purchased from home depot:

  • Watts (A-12) Ander-Lign Compression Tee
    • For splicing off the reservoir tank
  • Watts (A-4) Ander-Lign Compression Nut
    • For fridge connection
  • Watts Polyethylene Tubing (SPEB25) 1/4″ x 0.170″ x 25 ft

Hope this is helpful for others, as I couldn’t find how much to tighten the nuts.  Seems to work for me… your milage may vary.

BTSync on AWS EC2

Objective: Allow Ubuntu to start BTSync on reboot.



  1. create an EC2 instance, with appropriate storage space.
    • Ubuntu LTS 64bit (currently 14.04)
  2. download the BTSync client
  3. dump the btsync.conf
    1. ./btsync –dump-sample-config > btsync.conf
  4. edit the btsyn.conf for your settings.
  5. sudo su
  6. create /etc/init.d/btsync file
    • See below
  7. chmod 755 /etc/init.d/btsync
  8. update-rc.d btsync defaults
  9. service btsync start
  10. test the connection against other boxes.


  1. Since we’re on EC2, and security is paramount.
  2. Establish a port tunnel
    1. sudo ssh -i ~/.ssh/EC2KEY.pem -L 8888: ubuntu@serverHostNameOrIP
  3. Connect to the system via:
  4. Verify that all is working on the server end.



  1. Connect w/the shared keys.
  2. Verify that the system is working.
  3. Put a file into the shared folder. Notice that the file should go up to the server.


On the Server EC2 instance.

create the file /etc/init.d/btsync


# /etc/init.d/btsync
# @see: source

if (( $EUID != 0 )); then
    echo "Please run as root"

# Carry out specific functions when asked to by the system
case "$1" in
    /USERACCOUNT/.btsync/btsync --config /USERACCOUNT/.btsync/btsync.conf
    killall btsync
    echo "Usage: /etc/init.d/btsync {start|stop}"
    exit 1

exit 0


Update 2014-08-23

  • changed the init.d script to bash, and added root check.
  • Noticed that BTsync does not work well over a VPN connection.

How/What do you backup?

Things of importance

  1. Family photos/videos
  2. Documents
    1. scanned docs
    2. license/registration information for software
  3. Everything else.



How to backup, rule of 3-2-1

3 – (three) copies of everything of importance.

2 – (two) media types at least.  Remember floppies? Remember Zip disks? Beta tapes… yeah…

1 – (one) off site copy.  Home burns down… you’re fine, data wise… and insurance for the rest.

So, how do I implement this:

  • BTsync/dropbox/, to get offsite backups running quick and easy.  Sparkle share was a little too much effort, needing a git repo.
  • BT Sync, will make multiple copies easily across your network, with super ease.
  • my amazon ec2 instance will be a offsite node, which can then push to glacier or s3.

Eventually, I’ll write some crons to do the auto pushing to S3/glacier.  I’ll share them once I do (2014-08-03)

Mass VHOST wildcard; subdomain to folder

I couldn’t find any information as my search terms were incorrect. My google-fu was off when I was searching.

My objective was to make http://* go to /var/www/*/www, where * is a wildcard.

I’m hoping that this will help others; specifically developed that work on multiple projects.

First, I wanted to wildcard my in my hosts file. I knew I couldn’t do this: *

as that’s now how hosts files work.

DNSMASQ to the rescue, to wildcard the hosts file.
Apache mass vhost, is a technique to setup lots of vhosts based on a pattern.

Some applications such as magento likes to have a proper full domain name.  Also makes testing more realistic as well.

Since I’m on OSX, install it via ports.

The instructions are a mash of: and other sites… you may have to restart dnsmasq after you’ve made the changes.

sudo port install dnsmasq
sudo cp /opt/local/etc/dnsmasq.conf /etc/dnsmasq.conf
sudo mkdir -p /System/Library/StartupItems/DNSMASQ
3.) sudo mkdir -p /System/Library/StartupItems/DNSMASQ
4.) sudo nano /System/Library/StartupItems/DNSMASQ/DNSMASQ
. /etc/rc.common
if [ "${DNSMASQ}" = "-YES-" ]; then
  ConsoleMessage "Starting DNSMASQ" 
5.) sudo nano /System/Library/StartupItems/DNSMASQ/Startup Parameters.plist
  Description = "Local DNSMASQ Server";
  Provides = ("DNS Masq");
  OrderPreference = "None";
  Messages = 
  start = "Starting DNSMASQ";
  stop = "Stopping DNSMASQ";
6.) Add line to /etc/hostconfig
7.) sudo chmod +x /System/Library/StartupItems/DNSMASQ/DNSMASQ
8.) sudo /System/Library/StartupItems/DNSMASQ/DNSMASQ
9.) In network settings make sure is in your dns server list.  If you do:
  You should see something like this near the bottom (if not, your network settings need to 
  be applied.. try this to flush dns cache: dscacheutil -flushcache ):
    ;; SERVER:
  # test it.
  : PING ( 56 data bytes
  : 64 bytes from icmp_seq=0 ttl=64 time=0.031 ms

add the line to /etc/dnsmasq.conf
$> sudo nano -w /etc/dnsmasq.conf ## or your favourite editor, as root.


Clear your dns cache.

dscacheutil -flushcache

You may need to setup your network connection to point your DNS to localhost first.

sudo kill -HUP `cat /opt/local/var/run/`

my vhosts Magic

Alias /phpmyadmin /opt/local/www/phpmyadmin

<directory "/www">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

<directory "/opt/local/www/phpmyadmin">
	Options -Indexes FollowSymLinks
	AllowOverride AuthConfig FileInfo
	Order allow,deny
	Allow from all

UseCanonicalName Off

LogFormat "%V %h %l %u %t "%r" %s %b" vcommon
CustomLog logs/access_log vcommon

# include part of the server name in the filenames
VirtualDocumentRoot /www/hosts/%1/www