Really quick one. I was trying to fix an issue with Laravel Valet and was updating my version of PHP, which was installed via Brew. I'd updated my version of PHP by running
brew unlink php71 and then
brew link --force php71. However, while brew link was creating symlinks – as you'd expect – brew unlink was removing 0.
This resulted in the error
Module 'mcrypt' already loaded in Unknown on line 0 whenever I tried to run anything to do with PHP (e.g. Composer or tried to start Valet).
I tried to uninstall php71 and start again, but when I ran
brew uninstall firstname.lastname@example.org and
brew uninstall php71, both returned:
Error: Permission denied @ rb_file_s_lstat - /usr/local/Cellaremail@example.com/7.1.17/var/log/php-fpm.log
I decided to investigate exactly what was happening so I navigated via the command line to
/usr/local/Cellar/ and then opened the folder in finder using
On doing so, noticed there was a symlink to the php71 folder. Navigating to it, I found there were two versions of php7.1 installed. That made sense since the error suggests that two instances of mcrypt were running. Deleting the older version resolved the issue.
That's it. However, that wasn't the root of the problem. Ultimately the issue is that Brew wasn't removing the old symlinks.
Until they fix the issue, the best way to resolve the issue is when you see it unlinking 0 symlinks is to go in and manually remove the old file yourself.