Skip to content

Instantly share code, notes, and snippets.

@timogoosen
Created August 30, 2022 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timogoosen/8a13501aa8e4fed5e8f4daaa8949ba35 to your computer and use it in GitHub Desktop.
Save timogoosen/8a13501aa8e4fed5e8f4daaa8949ba35 to your computer and use it in GitHub Desktop.
Setup php7.4 Mac OSX alongside php7.3
brew install shivammathur/php/php@7.4
export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"
pecl install igbinary
pecl install redis
pecl install imagick
brew services restart php@7.4
curl -sS https://getcomposer.org/installer | php -- --version=1.10.16
sudo mkdir -p /usr/local/bin
sudo mv composer.phar /usr/local/bin/composer2
sudo chmod u+x /usr/local/bin/composer2
sudo chown root:wheel /usr/local/bin/composer2
composer2 --version
If you run into any issues with extensions being loaded double then check this config file:
vim /opt/homebrew/etc/php/7.4/php.ini
You might see extensions loaded twice like:
extension=redis.so
extension=redis.so
Just comment those out
@timogoosen
Copy link
Author

Extensions should be installed here:

$ ls /opt/homebrew/lib/php/pecl/20190902/

PhpStorm.app igbinary.so imagick.so redis.so

@timogoosen
Copy link
Author

If you run into:

checking for igbinary includes... configure: error: Cannot find igbinary.h
ERROR: `/private/tmp/pear/temp/redis/configure --with-php-config=/opt/homebrew/opt/php@7.4/bin/php-config --enable-redis-igbinary=yes --enable-redis-lzf=yes --enable-redis-zstd=yes' failed

Then try run

 export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"
pecl install redis

But then don't enable igbinary support when prompted during pecl install redis.

@timogoosen
Copy link
Author

Change port number here:

vim /opt/homebrew/etc/php/7.4/php-fpm.d/www.conf

This is the line to change:

# From:
# listen = 127.0.0.1:9000
# To below:
listen = 127.0.0.1:9075

Then restart service:

brew services restart php@7.4

Then:


$ lsof -i | grep php

php-fpm   95920 timo    9u  IPv4 0x8723fd3d358a72ad      0t0  TCP localhost:9075 (LISTEN)
php-fpm   95925 timo   10u  IPv4 0x8723fd3d358a72ad      0t0  TCP localhost:9075 (LISTEN)
php-fpm   95926 timo   10u  IPv4 0x8723fd3d358a72ad      0t0  TCP localhost:9075 (LISTEN)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment