First install Homebrew Install stable version of php using Homebrew This will start updating Homebrew – Updating tap and Formulae.The following dependencies will normally be installed through the command above. If your differs, the dependencies will install when it is necessary. apr, apr-util, argon2, aspell, m4, autoconf, brotli, gettext, libunistring, libidn2, libmetalink, libssh2, c-ares, jemalloc, libev, nghttp2, openldap, rtmpdump, zstd, curl, libtool, unixodbc, freetds, libpng, freetype, fontconfig, jpeg, libtiff, webp, gd, libffi, glib, gmp, icu4c, krb5, libpq, libsodium, libzip, oniguruma, pcre2 and tidy-html5 After all dependencies installation To enable PHP…