git clone https://github.com/php/php-src
cd php-src
git checkout php-7.3.0
./configure \
--disable-cgi \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-mysqlnd \
--enable-zip \
--with-zlib-dir=/usr/local/opt/zlib \
--with-openssl=/usr/local/opt/openssl \
--with-iconv=/usr/local/opt/libiconv \
--with-pdo-mysql=mysqlnd \
--with-curl \
--with-sodium \
--with-password-argon2
Open the generated Makefile in your IDE. It should contain the following two lines:
EXTRA_LDFLAGS = -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/libiconv/lib -L/usr/local/Cellar/libsodium/1.0.16/lib
EXTRA_LDFLAGS_PROGRAM = -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/libiconv/lib -L/usr/local/Cellar/libsodium/1.0.16/lib
For both lines, remove the following entry:
-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib
make -j 5
./sapi/cli/php -v