在MAMP Pro中安装zip扩展名

时间:2019-11-21 16:33:01

标签: php mamp pecl mamp-pro

我正在运行MAMP Pro,并尝试安装zip扩展程序,并且出现以下错误:

<script>
    var map, marker, i, e;
    var companies = {{ companies.items | json_encode() | raw }};

    console.log(companies);
    var address = {{ search.city.first.name | json_encode() | raw }};

    function initMap() {
        var geocoder = new google.maps.Geocoder();

        map = new google.maps.Map(document.getElementById('map'), {
            center: {lat: 44.8333, lng: -0.5667},
            zoom: 12,
            disableDefaultUI: true
        });

        //for (i = 0; i < locations.length; i++) {
            //marker = new google.maps.Marker({
                //position: new google.maps.LatLng(locations[i][1], locations[i][2]),
                //map: map
            //});

    }
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=APIKEYLOL&callback=initMap"></script>

我似乎缺少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$ ,但找不到有关如何解决此问题的信息。我需要zip扩展名才能安装Statamic插件。 我不确定从这儿去哪里。...任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:1)

首先抱歉我的英语,我是巴西人,我没有书面练习。

我在装有PHP 7.2.21的5.5.1版本上安装了MAMP PRO 我选中了“在命令行上提供此版本”选项。

在命令行中,我转到了文件夹
 “ /Applications/MAMP/bin/php/php7.2.21/lib/php/extensions/no-debug-non-zts-20170718/”
并运行命令pecl install zip,安装成功。

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

我禁用了XDebug扩展。

我重新启动了MAMP服务。

正在检查PHP版本: 在命令提示符下,我运行了php -v

PHP 7.2.21(CLI)(建立:2019年8月14日16:40:59)(NTS) 版权所有(c)1997-2018 The PHP Group Zend Engine v3.2.0,版权所有(c)1998-2018 Zend Technologies

检查ZIP库版本 php --re zip | grep zip 扩展名[扩展名47 zip版本1.15.4] {

执行命令laravel new <name>时,zip库错误继续。

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

为解决此问题,我强制使用laravel命令执行的PHP版本

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

我将第一行从#!/usr/bin/env php更改为#!/usr/bin/env /Applications/MAMP/bin/php/php7.2.21/bin/php

在这里效果很好。

希望它能对您有所帮助。