Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

php 7.3.8 zip extension missing From macOS 10.15 Catalina

Any idea where to find and install? It wasn’t installed during installation of macOS 10.15 Catalina.


Thanks in advance. David

Posted on Oct 12, 2019 8:23 AM

Reply
Question marked as Best reply

Posted on Oct 25, 2019 8:01 AM

OK. Here is how you do this. The instructions haven’t changed, in principle, from what I posted in Setting up a local web server on macOS 10… - Apple Community. There, I just link to this site that describes the basic procedure. As you might expect, there are a few more complications than there were in 2011 with OS X Lion. Here is what you do:


  1. You’ll need the Command Line tools for this. If you don’t already have them, run “gcc” from the command line to trigger the install.
  2. Download php 7.3.8 from the usual place. Make sure to dig into the archives to get this exact version to match what is on Catalina.
  3. Expand the source. This will give you the source code to the zip module that you will need.
  4. You will need the autoconf module to build the module. You’ll have to download that from the usual place and install into /usr/local.
  5. You will also need libzip. Download that.
  6. Alas, libzip has been updated substantially since I last used it. It is now based on CMake! <spits>
  7. Download and install CMake.
  8. Hack up your environment and put path to the every-so-hacky cmake tool into your PATH. Don’t try to get clever with an alias. That won’t work. 😄
  9. Once you have CMake installed, you can build and install libzip using the simple 6-step CMake build procedure. So simple!
  10. Now go back to your php source for the zip module and build that. I’ll save you some effort and suggest that you use the following configure line:


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

(Don't worry about the colours, that's just the forums formatting.)
(Forum software is a beast. Scroll right.)


  1. (Sorry about the forum numbering. This is step 10.)
  2. Now make the module, but don’t attempt to install. Well, you can attempt it. It won’t work.
  3. Create a directory /usr/local/lib/php/extensions for your modules
  4. Manually copy the zip.so file from modules into /usr/local/lib/php/extensions
  5. Copy the file /etc/php.ini.default to /etc/php.ini
  6. Edit /etc/php.ini and set your extension_dir path to /usr/local/lib/php/extensions
  7. In /etc/php.ini, look for the extensions section add add a line for zip, like so: “extension=zip"
  8. Restart Apache
  9. Reload info.php (from the instructions listed above) and verify that zip is now included.


Easy, peasy!



19 replies
Question marked as Best reply

Oct 25, 2019 8:01 AM in response to davidberg

OK. Here is how you do this. The instructions haven’t changed, in principle, from what I posted in Setting up a local web server on macOS 10… - Apple Community. There, I just link to this site that describes the basic procedure. As you might expect, there are a few more complications than there were in 2011 with OS X Lion. Here is what you do:


  1. You’ll need the Command Line tools for this. If you don’t already have them, run “gcc” from the command line to trigger the install.
  2. Download php 7.3.8 from the usual place. Make sure to dig into the archives to get this exact version to match what is on Catalina.
  3. Expand the source. This will give you the source code to the zip module that you will need.
  4. You will need the autoconf module to build the module. You’ll have to download that from the usual place and install into /usr/local.
  5. You will also need libzip. Download that.
  6. Alas, libzip has been updated substantially since I last used it. It is now based on CMake! <spits>
  7. Download and install CMake.
  8. Hack up your environment and put path to the every-so-hacky cmake tool into your PATH. Don’t try to get clever with an alias. That won’t work. 😄
  9. Once you have CMake installed, you can build and install libzip using the simple 6-step CMake build procedure. So simple!
  10. Now go back to your php source for the zip module and build that. I’ll save you some effort and suggest that you use the following configure line:


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

(Don't worry about the colours, that's just the forums formatting.)
(Forum software is a beast. Scroll right.)


  1. (Sorry about the forum numbering. This is step 10.)
  2. Now make the module, but don’t attempt to install. Well, you can attempt it. It won’t work.
  3. Create a directory /usr/local/lib/php/extensions for your modules
  4. Manually copy the zip.so file from modules into /usr/local/lib/php/extensions
  5. Copy the file /etc/php.ini.default to /etc/php.ini
  6. Edit /etc/php.ini and set your extension_dir path to /usr/local/lib/php/extensions
  7. In /etc/php.ini, look for the extensions section add add a line for zip, like so: “extension=zip"
  8. Restart Apache
  9. Reload info.php (from the instructions listed above) and verify that zip is now included.


Easy, peasy!



Oct 15, 2019 7:50 AM in response to BobTheFisherman

Yes, I do need the php zip extension. I am using phpspreadsheet to create excel spreadsheets. That php add-on requires the zip extension in order to create xlsx files. The second installation would be a workaround for the missing extension in the php NOT installed as part of the macOS 10.15 Catalina installation.


There are several others who have this same issue and have so far been unsuccessful in adding just that extension.

Nov 5, 2019 10:35 AM in response to etresoft

This almost got me working, but PHP throws an unsigned code error:


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


In case it helps someone, here's the step-by-step I've used to this point:


https://superuser.com/questions/1499342/how-to-get-zip-extension-working-in-php-in-macos-10-15-1


If anyone has any suggestions for resolving the unsigned code issue, I'd appreciate hearing them. Note that in my case, Homebrew isn't really a good option; we're using some self-signed certificates, and I haven't been able to convince the Homebrew PHP install to accept them.

Nov 5, 2019 1:57 PM in response to Bill-OA-ITSD

You are trying to run PHP on the command line. That’s a totally different environment. You might need to sign it there for all I know. I’ve already blown away my VM and I have no intention of re-building it. My instructions work and load the zip module when running PHP from Apache. If you need to sign the zip library, then sign it.

Nov 6, 2019 6:57 AM in response to etresoft

No offense intended. Just trying to flesh this information out a bit for folks that are trying to get PHP working on the command line (most of the discussions I've found about this problem are from people who, like me, are trying to use composer). Combining your instructions with those of a couple of other people seems to come very close to solving the issue, but not quite.


Another user suggested that running make install would sign the extension, even though it would fail to move it into the necessary location:


https://superuser.com/a/1492340/1109520


...but this doesn't appear to be the case. If signing is a simple matter that I can do myself, I'll look into that.

Nov 6, 2019 10:24 AM in response to Bill-OA-ITSD

You will need a paid developer account to sign the library so that php will load it. This is not necessary if you are running it via apache. Running PHP and Apache on a Mac is possible for basic web development tasks. If you need more than that, you should be using Linux. You can build the entire stack on a Mac, but I would not recommend it.

Nov 6, 2019 3:08 PM in response to etresoft

Our entire department uses Macs as local development environments for building Drupal websites. We don't host the sites on the Macs (that happens on various AWS environments), but we run local copies of the sites for development purposes. Most of this is done within a *AMP stack (provided in a variety of ways -- Acquia Dev Desktop, MAMP, etc.) -- but some of the work is done using composer, and that requires command-line PHP. Up until 10.15, this hasn't been an issue.


We have the option, of course, of using Homebrew, but that introduces some other nuisances due to self-signed SSL certificates, so we try to avoid it. Still, that's the workaround we're using at present.


I've heard the zip extension will be restored to the system PHP install in 10.15.2, and then everything can go back to normal. Unfortunately, I've only heard this from a single source, so I don't really have any idea if it's true.

Nov 6, 2019 8:07 PM in response to Bill-OA-ITSD

The only official word from Apple that I’ve heard is that all scripting languages are getting ripped out. I don’t know if that includes PHP or not.


I attempted to build all of PHP but lost interest when I started getting flashbacks from the good old days of trying to get libiconv to link.


I still wouldn’t recommend attempting that level of development work on a Mac. Maybe use Docker. It looks like you are going to have to build it all yourself anyway.

php 7.3.8 zip extension missing From macOS 10.15 Catalina

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.