shivammathur / homebrew-php

:beer: Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.

Home Page:https://github.com/shivammathur/homebrew-php/packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ext-imap

OskarStark opened this issue Β· comments

Describe the feature
ext-imap

Hi πŸ‘‹

First of all thanks for your work on this πŸ’Ÿ

I am currently stuck, because I don't really know how to install/enable the imap extension. Can you give me any hints?

Thanks

Btw currently I am trying to install imagick for all versions like this and want to install imap too:

#!/bin/bash

PHP_VERSIONS="7.4 7.3"

echo "Remove all available PHP configs"
rm -rf /usr/local/etc/php/*

brew install imagemagick

for version in $PHP_VERSIONS
do
    echo "Install PHP $version"

    brew reinstall shivammathur/php/php@$version
    brew link --overwrite --force php@$version

    echo "Extension: imagick"
    if ! pecl list | grep imagick >/dev/null 2>&1;
    then
        echo "Install and enable: imagick"
        yes '' | pecl install imagick
    else
        echo "Already installed, but enable: imagick"
        echo "extension=imagick.so" >> /usr/local/etc/php/$version/php.ini
    fi

    php -v
    php -m | grep imagick
done

symfony local:php:refresh
symfony local:php:list

Is there anything easier πŸ˜„

cc @localheinz

@OskarStark I would recommend using shivammathur/extensions tap. It now has both imagick and imap.
https://github.com/shivammathur/homebrew-extensions

PHP_VERSIONS="7.4 7.3"

echo "Add taps"
brew tap shivammathur/php
brew tap shivammathur/extensions

echo "Remove all available PHP configs"
rm -rf /usr/local/etc/php/*

for version in $PHP_VERSIONS
do
    echo "Install PHP $version"

    brew reinstall shivammathur/php/php@$version
    brew link --overwrite --force php@$version

    echo "Extension: imagick"
    brew reinstall shivammathur/extensions/imagick@$version
    brew reinstall shivammathur/extensions/imap@$version

    php -v
    php -m | grep imagick
    php -m | grep imap
done

symfony local:php:refresh
symfony local:php:list

Oh thank you very much, it works like a charm:

#!/bin/bash

PHP_VERSIONS="7.1 7.2 7.3 7.4 8.0"
EXTENSIONS="imagick imap"

echo "Add taps"
brew tap shivammathur/php
brew tap shivammathur/extensions

echo "Remove all available PHP configs"
rm -rf /usr/local/etc/php/*

for version in $PHP_VERSIONS
do
    echo "Install PHP $version with: $EXTENSIONS"

    brew reinstall shivammathur/php/php@$version
    brew link --overwrite --force php@$version

    for extension in $EXTENSIONS
    do
        echo "Extension: extension"
        brew reinstall shivammathur/extensions/$extension@$version
    done

    php -v
    for extension in $EXTENSIONS
    do
        php -m | grep $extension
    done
done

symfony local:php:refresh
symfony local:php:list

I will open another feature request for amqp which is a bit hacky now:

    echo "Extension: amqp"
    if ! pecl list | grep amqp >/dev/null 2>&1;
    then
        echo "Install and enable: amqp"
        yes '/usr/local/Cellar/rabbitmq-c/0.10.0' | pecl install amqp
    else
        echo "Already installed, but enable: amqp"
        echo "extension=amqp.so" >> /usr/local/etc/php/$version/php.ini
    fi

Sorry for reopening this issue, but I receive:

CleanShot 2021-11-29 at 16 28 51@2x

This is my current script:

#!/bin/bash

# This is based on:
# * https://github.com/shivammathur/homebrew-php
# * https://github.com/shivammathur/homebrew-extensions

PHP_VERSIONS="5.6 7.0 7.1 7.2 7.3 7.4 8.1 8.0" # last one is used as default PHP version
EXTENSIONS="amqp imagick imap pcov redis"

echo "Add taps (--force-auto-update)"
HOMEBREW_DEVELOPER=1 brew untap shivammathur/php
brew tap shivammathur/php --force-auto-update
HOMEBREW_DEVELOPER=1 brew untap shivammathur/extensions
brew tap shivammathur/extensions --force-auto-update

echo "Remove all available PHP configs"
rm -rf /usr/local/etc/php/*

for version in $PHP_VERSIONS
do
    echo "Install PHP $version with: $EXTENSIONS"

    brew reinstall shivammathur/php/php@$version
    brew link --overwrite --force php@$version

    for extension in $EXTENSIONS
    do
        if [ "$extension" = "pcov" ] && { [ "$version" = "5.6" ] || [ "$version" = "7.0" ]; }; then break; fi

        echo "Extension: $extension"

        if [ "$extension" = "redis" ]; then
            brew remove redis@$version || true
            brew remove igbinary@$version || true
            brew remove msgpack@$version || true
        fi

        brew reinstall shivammathur/extensions/$extension@$version
    done

    php -v
    for extension in $EXTENSIONS
    do
        php -m | grep $extension
    done
done

symfony local:php:refresh
symfony local:php:list

Any clue?

@OskarStark

I had to fork imap-uw from homebrew-core into this tap as core no longer accepts patches to it.

Please run brew uninstall imap-uw as suggested by the error and then re-run your script.

This works, thanks!