I've cobbled the following procedure together from a couple of different questions here, and on the Apple support forums. None of them have worked on their own, but this appears to be close. The problem is I wind up with an unsigned extension that MacOS refuses to load; can anyone help me get that last (I hope) problem resolved?
1. Install autoconf.
cd ~/Downloads
curl -O -L http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make
sudo make install
2. Install automake
cd ~/Downloads
curl -O -L http://ftpmirror.gnu.org/automake/automake-1.15.tar.gz
tar -xzf automake-1.15.tar.gz
cd automake-1.15
./configure
make
sudo make install
3. Install libtool
cd ~/Downloads
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz
tar -xzf libtool-2.4.6.tar.gz
cd libtool-2.4.6
./configure
make
sudo make install
4. Install CMake
Download the disk image from: https://github.com/Kitware/CMake/releases/download/v3.16.0-rc3/cmake-3.16.0-rc3-Darwin-x86_64.dmg
Mount the image and drag the application to your Applications folder.
Edit your .zshrc file (or create one in your home directory if you don't have one).
Add the line:
export PATH="$PATH:/Applications/CMake.app/Contents/bin"
Save the file and type the command:
source ~/.zshrc
5. Install libzip
cd ~/Downloads
curl -OL https://libzip.org/download/libzip-1.5.2.tar.gz
tar -xzf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build
cd build
cmake ..
make
sudo make install
6. Create a temporary copy of phpize that uses Xcode's libraries
cd ~
cp /usr/bin/phpize ~/Desktop/
Edit the copy of phpize that's now on your desktop, and change this line:
includedir="`eval echo ${prefix}/include`/php"
...to:
includedir="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php"
Save the modified phpize file.
7. Download the source code for the correct version of PHP -- 7.3.9 as of MacOS 10.15.1
cd ~/Downloads
curl -O -L https://www.php.net/distributions/php-7.3.9.tar.bz2
tar -yxf php-7.3.9.tar.bz2
cd php-7.3.9/ext/zip
8. Build the extension
~/Desktop/phpize
CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php/main -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php/Zend -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php/TSRM -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php" ./configure --with-zlib-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr --with-php-config=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/bin/php-config
make
make install
sudo mkdir /usr/local/lib/php/extensions
sudo mv modules/zip.so /usr/local/lib/php/extensions/
NOTE: I expect make install to fail due to permission errors, but one of the other discussions I found suggested that this step was necessary to sign the code. It doesn't seem to have that effect, however.
9. Edit the /etc/php.ini file
extension_dir="/usr/local/lib/php/extensions"
extension=zip
10. Test with command:
php --version
Result
PHP Warning: PHP Startup: Unable to load dynamic library 'zip' (tried: /usr/local/lib/php/extensions/zip (dlopen(/usr/local/lib/php/extensions/zip, 0x0009): dlopen(): file not found: /usr/local/lib/php/extensions/zip), /usr/local/lib/php/extensions/zip.so (dlopen(/usr/local/lib/php/extensions/zip.so, 0x0009): code signature in (/usr/local/lib/php/extensions/zip.so) not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.)) in Unknown on line 0