Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MacOS Catalina: Class 'ZipArchive' not found

Upgrading to 10.15.1 (19B88) Mac OS Catalina broke my PHP 7.3.9 development environment.

$zip = new \ZipArchive;

Yields Exception 'Error' with message 'Class 'ZipArchive' not found'

zip and unzip are installed at Terminal command line.

Trying to use PECL failed. Trying to use Homebrew failed.

Do you know how to properly install ZipArchive manually on MacOS?

like image 503
Lookahead Avatar asked Jan 26 '23 16:01

Lookahead


1 Answers

I had the same problem and this is what helped me. Basically what I did is I just installed php using brew and then linked the php that I have installed using brew inside of httd.conf file. Here are the steps:

  1. Install php using home brew

    brew install [email protected]

This will install php. Now we need to link it

brew link [email protected]

If the command above wont work because of the missing directories, then just create them using mkdir and run it again.

  1. Link you php in httd.conf file

Open the httpd.conf file which is located here /private/etc/apache2/httpd.conf Open it and change this line

LoadModule php7_module libexec/apache2/libphp7.so

to this:

LoadModule php7_module /usr/local/Cellar/php/7.3.11/lib/httpd/modules/libphp7.so

What this basically dow is it just makes apache to use php that is installed using homebrew. Hope this was helpful to you.

Here is a link where it is better described how to connect homebrew installed php:

How to use the php that brew installed?

like image 67
Gleb Moisseyev Avatar answered Jan 28 '23 04:01

Gleb Moisseyev