简体   繁体   English

在 MAMP Pro 中安装 zip 扩展

[英]Install zip extension in MAMP Pro

I am running MAMP Pro and trying to install the zip extension, and am getting the following error:我正在运行 MAMP Pro 并尝试安装 zip 扩展,并收到以下错误:

MacBook-Pro:bin michaelharrison$ pecl install zip
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading zip-1.15.5.tgz ...
Starting to download zip-1.15.5.tgz (286,794 bytes)
............................................................done: 286,794 bytes
14 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
building in /private/tmp/pear/temp/pear-build-michaelharrisonllhfLo/zip-1.15.5
running: /private/tmp/pear/temp/zip/configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin19.0.0
checking host system type... x86_64-apple-darwin19.0.0
checking target system type... x86_64-apple-darwin19.0.0
checking for PHP prefix... /Applications/MAMP/bin/php/php7.2.1
checking for PHP includes... -I/Applications/MAMP/bin/php/php7.2.1/include/php -I/Applications/MAMP/bin/php/php7.2.1/include/php/main -I/Applications/MAMP/bin/php/php7.2.1/include/php/TSRM -I/Applications/MAMP/bin/php/php7.2.1/include/php/Zend -I/Applications/MAMP/bin/php/php7.2.1/include/php/ext -I/Applications/MAMP/bin/php/php7.2.1/include/php/ext/date/lib
checking for PHP extension directory... /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718
checking for PHP installed headers prefix... /Applications/MAMP/bin/php/php7.2.1/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for zip archive read/writesupport... yes, shared
checking libzip... yes
checking PHP version... 7.0/7.1/7.2
checking for pkg-config... no
checking for libzip... not found
configure: error: Please reinstall the libzip distribution
ERROR: `/private/tmp/pear/temp/zip/configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config' failed
MacBook-Pro:bin michaelharrison$ 

It looks like I am missing the libzip distribution but I can't find info on how to fix this issue.看起来我缺少libzip distribution ,但我找不到有关如何解决此问题的信息。 I need the zip extension to install a Statamic addon.我需要 zip 扩展来安装 Statamic 插件。 I am not sure where to go from here.... any help appreciated.我不知道 go 从这里到哪里....任何帮助表示赞赏。

First sorry for my English, I am Brazilian and I have no practice in writing.首先对不起我的英语,我是巴西人,我没有写作经验。

I have MAMP PRO installed on version 5.5.1 with PHP 7.2.21 I checked the "Make this version available on the command line" option.我在版本 5.5.1 上安装了 MAMP PRO,其中 PHP 7.2.21 我检查了“使此版本在命令行上可用”选项。

At the command line I went to the folder在命令行我去了文件夹
"/Applications/MAMP/bin/php/php7.2.21/lib/php/extensions/no-debug-non-zts-20170718/" “/Applications/MAMP/bin/php/php7.2.21/lib/php/extensions/no-debug-non-zts-20170718/”
and ran the command pecl install zip and the installation was successful.并运行命令pecl install zip安装成功。

I edited the php.ini file via Mamp PRO and enabled the extension:我通过 Mamp PRO 编辑了php.ini文件并启用了扩展:
extension=/Applications/MAMP/bin/php/php7.2.21/lib/php/extensions/no-debug-non-zts-20170718/zip.so

I disabled the XDebug extension.我禁用了 XDebug 扩展。

I restarted the MAMP service.我重新启动了 MAMP 服务。

Checking PHP version: At the command prompt I ran php -v检查 PHP 版本:在命令提示符下,我运行了 php -v

PHP 7.2.21 (cli) (built: Aug 14 2019 16:40:59) (NTS) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies PHP 7.2.21 (cli) (built: Aug 14 2019 16:40:59) (NTS) Copyright (c) 1997-2018 The PHP Group Zend Technologies 1998), 版权所有

Checking ZIP Library Version php --re zip |检查 ZIP 库版本php --re zip | grep zip Extension [ extension # 47 zip version 1.15.4] { grep zip 扩展[扩展#47 zip 版本 1.15.4] {

When executing command laravel new <name> the zip library error continued.执行命令laravel new <name>时,zip 库错误继续。

Error
The Zip PHP extension is not installed. Please install it and try again.

To solve I forced the version of PHP executed by the laravel command为了解决我强制 laravel 命令执行的 PHP 的版本

vim ~/.composer/vendor/laravel/installer/laravel

I changed the first line from #!/usr/bin/env php to #./usr/bin/env /Applications/MAMP/bin/php/php7.2.21/bin/php我将第一行从#!/usr/bin/env php#./usr/bin/env /Applications/MAMP/bin/php/php7.2.21/bin/php

This worked well here.这在这里运作良好。

I hope it helped you.我希望它对你有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM