You need to set the correct defaults or you'll keep battling with this. See /usr/ports/Mk/bsd.default-versions.mk:I had a helluva job trying to get the latest version postgresql working with the latest php. After installing postgresql 9.6, php5.6 immediately deleted postgresql96-client, insisting that 9.5 be used. Then when I tried installing php7.1 I came across a whole new battleground. It is doable, but I would hardly call it a trivial task.
DEFAULT_VERSIONS+= php=7.1 pgsql=9.6