Local Grav PHP ZIP Extension workaround on macOS Catalina


The Apache and PHP bundled with macOS Catalina 10.15 does not include the PHP ZIP extension. Grav (specifically, the Problems Plugin) detects this issue, and Grav will not run! Here is a workaround.

Running Grav v1.6.x locally with the current Catalina release (including the most recent update), Grav immediately displays this error:

Grav PHP ZIP Extension problem

Getting the ZIP extension involves either:

  • Using Brew or similar to install a separate copy of Apache and PHP, or
  • Jumping through hoops to compile zip.so locally.

Instead I just wanted a quick hack to ignore this error. BEWARE! This means Grav does not know that zip.so is not available, and any functions that rely on ZIP will fail - including the ability to auto-update.

Option 1: Disable Problems Plugin

  1. In your Grav folder, navigate to user/config/plugins/
  2. Edit problems.yaml and disable the plugin:
    enabled: false
    built_in_css: true
  3. Try again.

Option 2: Edit the Problems Plugin

If you want to continue to use the Problems plugin to to detect other problems but suppress ZIP error, then:

  1. In your Grav folder, navigate to user/plugins/problems/classes/Problems/
  2. Edit the file PHPModules.php, comment out the $modules_error['zip'] assignment in this block of code:
    // Check for PHP Zip library
    $msg = 'PHP Zip extension is %s installed';
    if (extension_loaded('zip')) {
        $modules_success['zip'] = sprintf($msg, 'successfully');
    } else {
        //$modules_errors['zip'] = sprintf($msg, 'required but not');
  3. Try again.

Hope this helps.

FYI at time of writing, I am on Catalina 10.15.5, with Apache 2.4.41 and PHP 7.3.11 - to check:

httpd -v
php -v