PHP was not working for me as I was encountering this libpng issue, so I reinstalled a new version with Homebrew.
However, I\'m getting a similar error with
I was having the same problem and the only thing that helped was to use the --build-from-source parameter:
--build-from-source
brew install php70 --build-from-source