Valet: PHP Warning: Module 'zip' already loaded in Unknown on line 0

Created on 20 Apr 2020  路  5Comments  路  Source: laravel/valet

Hello,

I've followed the Laravel Valet docs, and the PHP and MySQL steps worked great. But when i type valet install i get those error messages:

PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Parse error:  syntax error, unexpected 'zip' (T_STRING), expecting ')' in Command line code on line 2
Password:
PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Parse error:  syntax error, unexpected 'zip' (T_STRING), expecting ')' in Command line code on line 2
PHP Warning:  Module 'zip' already loaded in Unknown on line 0

Warning: Module 'zip' already loaded in Unknown on line 0
Could not open input file:
Warning: Module 'zip' already loaded in Unknown on line 0

Parse error: syntax error, unexpected 'zip' (T_STRING), expecting ')' in Command line code on line 2/cli/valet.php

Is there maybe a package installed with homebrew that i have to remove?.

I'm not sure what to do :(..

Most helpful comment

And its fixed! @drbyte :blush:

Removing extension="zip.so" from /usr/local/etc/php/7.4/php.ini was the solution.

All 5 comments

Observations:

  • the Password prompt suggests that you're encountering permissions issues. This could prevent Homebrew from being able to install/update/clean files while Valet is installing things.
  • the parse/syntax error looks like a PHP 5 error when running PHP 7 code. You gave no details about your OS version or current PHP version.
  • when PHP says "module already loaded" it usually means that the php.ini or auto-loaded additional .ini/.conf files contain directives to load the stated module, but you've got it listed multiple times. This suggests perhaps you're re-installing a homebrew PHP version for which you already had a prior config set up and that config is conflicting; deleting the /usr/local/etc/php/XXXX directory for the PHP version you're installing might help. But you should fix the other issues first.

My OS is Mac OS Catalina, the installed PHP Version from brew is 7.4, and my PHP CLI version is 7.3.11. And in my /usr/local/etc/php folder i only have the 4.3 folder.

Edit: And in my /usr/bin Folder are those three files: php, phpize, and php-config.

I tryed to delete the /usr/bin/php file (But i created a backup of that file), and now if i type php --ini i get this error:

php --ini
PHP Warning:  Module 'zip' already loaded in Unknown on line 0

Warning: Module 'zip' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File:         /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini

And php -v says:

php -v
PHP Warning:  Module 'zip' already loaded in Unknown on line 0

Warning: Module 'zip' already loaded in Unknown on line 0
PHP 7.4.5 (cli) (built: Apr 18 2020 03:17:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.5, Copyright (c), by Zend Technologies

And its fixed! @drbyte :blush:

Removing extension="zip.so" from /usr/local/etc/php/7.4/php.ini was the solution.

You'll probably want to figure out why the extension was already loaded, since normally "the" place it's loaded is from php.ini, and thus you'll run into the same problem again if you switch PHP versions.

Nevertheless, I'm glad you've found some sort of solution for your unique case.

Please click "Close" below to close the issue.

Was this page helpful?
0 / 5 - 0 ratings