phpzipconfigintl

Trying to install intl extension macOS Catalina and PHP 7.4.10


I am trying to install the zip and the intl extension for PHP 7.4.10

I run

sudo pecl install intl

and then the installation is requesting :

Specify where ICU libraries and headers can be found [DEFAULT] : 

then I hit enter and continues but then it shows the next error:

configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

then I start to look how to install icu, I run:

brew install icu4c

the console shows:

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/user/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/user/.bash_profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export .bash_profile="/usr/local/opt/icu4c/lib/pkgconfig"

I added all the paths to the .bash_profile config file and run:

source .bash_profile

at this point I am not sure what todo I am still receiving:

== Environment ==
!! php_extension zip !!
[System] must be installed and enabled - The Zip PHP extension is now required by Moodle, info-ZIP binaries or
PclZip library are not used anymore.


!! php_extension intl !!
[System] must be installed and enabled - Intl extension is required to improve internationalization support, such as
locale aware sorting and international domain names.

even after run sudo apachectl restart

also I have check a lot of guides to install the zip extension via php.ini adding extension=zip but is not working

any help will be appreciated

[UPDATE]I tried to use the fist answer to the post and I got after run all and the last command output was sudo pecl update-channels && sudo pecl install intl

checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-icu-dir=/usr/local/opt/icu4c' failed

Solution

  • Is icu4c present on your system ? What is the output of:

    which icu4c
    

    If you have no output we can investigate further. A quick look at the ICU documentation tell us that the library relies on autoconf.

    brew update
    
    brew install autoconf automake libtool
    
    brew install icu4c
    

    Now let's check if icu4c is installed properly

    which icu4c
    

    If at this point you still have no output then it's better to install and compile icu4c from source.Because this library installed via Homebrew could be suffering from multiple issues.

    wget https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz
    
    tar xvfz icu4c-67_1-src.tgz
    
    cd icu/source
    
    ./configure --prefix=/usr/local/opt/icu4c/67_1 --enable-icu-config
    sudo make && sudo make install
    

    Afterwards you can resume

    sudo pecl update-channels && sudo pecl install intl
    

    If you will be asked

    Specify where ICU libraries and headers can be found [DEFAULT] :

    The answer is

    /usr/local/opt/icu4c