I installed node using homebrew (Mojave), afterwards php stoped working and if I try to run php -v I get this error:
php -v
php -v dyld: Library not lo
For me brew reinstall nodejs fixed this - my issue was with running Elixir/Phoenix so not PHP specific, I think it was caused by brew install postgres, but reinstalling that didn't help. I was getting it from npm commands.
brew reinstall nodejs
brew install postgres
npm