Homebrew-core: APCu missing from [email protected] - used to be as easy as brew install php72-apcu

Created on 4 Apr 2018  路  11Comments  路  Source: Homebrew/homebrew-core

php72-apcu is deprecated and I don't see any replacement in here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb - For PHP 7.x see https://pecl.php.net/package/apcu_bc as described here https://secure.php.net/manual/en/apcu.installation.php

APCu is for instance being used - mich like memcached - to store data - afaik - in all shared php-fpm instances. For instance CakePHP 3 (and most likely 4) does/will support APCu out of the box even in PHP 7.x installations: https://book.cakephp.org/3.0/en/core-libraries/caching.html

outdated

Most helpful comment

We will not accept versioned formulae such as php71-mcrypt but any of those listed on https://brew.sh/analytics/install/ will be accepted as part of the default, core or versioned php formulae as resources.
We will accept additional application (not library) formulae (such as composer) listed here: https://brew.sh/analytics/install/

Source: https://github.com/Homebrew/homebrew-php/issues/4721

It is sad that homebrew updates broke ways to setup working dev boxes without any more fiddling (such as pecl)

All 11 comments

With the migration to Homebrew-core the php formula has stopped taking over the role of PECL. Installing APCu can (and should) be done through PECL (https://pecl.php.net/package/apcu_bc) as you noticed.

We will not accept versioned formulae such as php71-mcrypt but any of those listed on https://brew.sh/analytics/install/ will be accepted as part of the default, core or versioned php formulae as resources.
We will accept additional application (not library) formulae (such as composer) listed here: https://brew.sh/analytics/install/

Source: https://github.com/Homebrew/homebrew-php/issues/4721

It is sad that homebrew updates broke ways to setup working dev boxes without any more fiddling (such as pecl)

Well it's in fact easier to not maintain a already maintained package manager like pecl and or pear. In fact its better that way, as the most problems I had with the old setup was for example an update of a depending library within homebrew. suddenly everything went mayham and nothing worked until it got updated. I guess now that this php packages are within the core repository that will not happen as depending packages are most likely be faster updated from now on. At least this would be a premise I could live with if thats some kind of the intent to merge the sattelites together.

Problem here is also the decreasing count of maintainers of the homebrew project itself. It is just sensible to deliver stable packages instead of having a whole workday of "Oh I did brew upgrade and now php does not work anymore because libicu updated. Lets use version switching.. Ohh I guess I have an semi-automated upgrade process which brew cleans... well no PHP devving for today... Lets google how to downgrade brew to a state where I can pull the old version..." -- And thats not a fictive story either...

@Blackskyliner yes, this should be a pretty significant improvement in usability because brew upgrade will no longer break php* when there are changes in its dependencies.

@ilovezfs so can you explain the note in https://github.com/Homebrew/homebrew-php/issues/4721 - should php-apcu be PRed against homebrew-core or not?

If you can make the case that it should be installed by default for every new PHP install you can make a PR to add it to the php formula.

So homebrew-core php formular brings pecl support: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb#L213

Should be as easy as:

brew install php;
pecl channel-update pecl.php.net;
pecl install apcu;

But first time around I got errors, I had to uninstall brew php and reinstall it then pecl.

SMillerDev it is still a very good choice for fpm-based data caching AFAIR:
Supported by CakePHP, Symfony, Drupal, Wordpress, MediaWiki: https://stackoverflow.com/a/27215230

So I tried another machine and ran into problems. This should be good:

brew update; # updates local brew meta data
brew untap homebrew/php; # removes old homebrew php tab, now php is in homebrew core
brew list | grep 'php'; # check for all php related installs
brew uninstall php72-apcu; # If you had that previously, also remove all the other libs
brew uninstall php; # or brew uninstall php72 if you had that before
brew upgrade; # make sure all the other libs are up to date
brew cleanup; # cleanup old files
brew prune; # cleanup old symlinks
brew install autoconf; # Required by pecl
brew install php;
pecl channel-update pecl.php.net;
php --modules | grep 'apcu'; # should not echo apcu, if it does it is already installed, no need to run pecl install apcu then
pecl install apcu; # Install other pecl modules that you are still missing in a similar fashion
php --modules | grep 'apcu'; # should echo apcu
brew services start php; # If you want php fpm and such

You may also need to delete/modify contents of /usr/local/etc/php to remove old modules. If you didn't manually tinker in there I'd say it is save to remove after running brew uninstall php


Edit: Updated to untap from old homebrew/php and update/upgrade brew before installing new php.

I found this when trying to update myself to the new way of php via brew. @inoas tip on using pecl is appreciated. I did have to install autoconf as well, but after that it just worked. Thanks!

Overall, I personally find it error-prone to mix and match package managers, but as I'm not able to do the work to keep the packages updated, I cannot complain too much. :)

Try cleaning up /usr/local/etc/php directory (Backup ini) and install php fresh again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghostbar picture ghostbar  路  4Comments

yuna9 picture yuna9  路  4Comments

oli-laban picture oli-laban  路  3Comments

gregvirgin picture gregvirgin  路  3Comments

faraazkhan picture faraazkhan  路  3Comments