Skip to content

Instantly share code, notes, and snippets.

@abenevaut
Last active March 9, 2024 23:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abenevaut/5ef6580bcaed241992cd1f58d205fac4 to your computer and use it in GitHub Desktop.
Save abenevaut/5ef6580bcaed241992cd1f58d205fac4 to your computer and use it in GitHub Desktop.

Install phpbrew && php 7.4.0 on macOS

xcode-select --install

# You should install brew https://brew.sh/index_fr
brew install automake autoconf curl pcre bison re2c mhash libtool icu4c gettext jpeg openssl libxml2 mcrypt gd gmp libevent zlib libzip bzip2 imagemagick pkg-config oniguruma
brew link --force icu4c
brew link --force openssl
brew link --force libxml2

curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew

phpbrew init
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
# See also https://github.com/phpbrew/phpbrew#variants
# add +zts if needed
# add +fpm if needed
phpbrew --debug install php-7.4.0 +gd +default +sqlite +mysql +bz2=/usr/local/Cellar/bzip2/1.0.8/ +zlib=/usr/local/Cellar/zlib/1.2.11/ -- --with-gd=shared
# use php 7.4.0 as default php binary
phpbrew switch 7.4.0

#
# Note: php.ini path
# ~/.phpbrew/php/php-7.4.0/etc/php.ini
#

# See also https://github.com/phpbrew/phpbrew/wiki/Extension-Installer
phpbrew ext install xdebug stable
phpbrew ext install soap stable
phpbrew ext install gmp stable
phpbrew ext install gd stable -- --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/
phpbrew ext install exif stable
phpbrew --debug ext install imagick stable  -- --with-imagick=/usr/local/Cellar/imagemagick/7.0.9-27/
# intl specifications
export LDFLAGS="-L/usr/local/opt/icu4c/lib" 
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
phpbrew ext install intl stable
// ~/.phpbrew/php/php-7.4.0/var/db/xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
xdebug.remote_autostart = 1
xdebug.file_link_format = phpstorm://open?%f:%l
@abenevaut
Copy link
Author

AppStore feature is not longer available (phpbrew app get <app>) phpbrew/phpbrew#1161, you have to install composer and others vendors outside phpbrew:
brew install composer

@abenevaut
Copy link
Author

abenevaut commented May 5, 2020

brew install libiconv
phpbrew extension install iconv -- --with-iconv=/usr/local/opt/libiconv

@abenevaut
Copy link
Author

abenevaut commented Jul 22, 2020

config for .phpbrew/php/php-7.1.29/etc/php-fpm.d/www.conf

  • timezone for php-fpm
    php_admin_value[date.timezone] = Europe/Paris

  • 504 Gateway timeout ?
    request_terminate_timeout = 300s

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