Skip to content

Instantly share code, notes, and snippets.

@abenevaut
Last active March 9, 2024 23:56
Show Gist options
  • Save abenevaut/fd21704ead845e5bc14ca93fa8d0a18f to your computer and use it in GitHub Desktop.
Save abenevaut/fd21704ead845e5bc14ca93fa8d0a18f to your computer and use it in GitHub Desktop.

Install phpbrew && php 7.3.10 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
brew link 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
phpbrew --debug install php-7.3.10 +gd +default +sqlite +mysql +bz2=/usr/local/Cellar/bzip2/1.0.6_1/ +zlib=/usr/local/Cellar/zlib/1.2.11/ -- --with-gd=shared
# use php 7.3.10 as default php binary
phpbrew switch 7.3.10

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

# See also https://github.com/phpbrew/phpbrew#installing-extra-apps
phpbrew app get phpunit
phpbrew app get phpcs
phpbrew app get composer
# See also https://github.com/phpbrew/phpbrew/wiki/Extension-Installer
phpbrew ext install xdebug stable
phpbrew ext install intl 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.8-43/
// ~/.phpbrew/php/php-7.3.10/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

phpbrew ext install gettext -- --with-gettext=/usr/local/opt/gettext

@abenevaut
Copy link
Author

brew install libiconv
phpbrew ext install iconv -- --with-iconv=$(brew --prefix libiconv)

@abenevaut
Copy link
Author

tail ~/.phpbrew/php/php-7.3.10/var/log/php_errors.log

@abenevaut
Copy link
Author

abenevaut commented Apr 28, 2020

Note for catalina brew vendors update :

When :

brew update automake autoconf curl pcre bison re2c mhash libtool icu4c gettext jpeg openssl libxml2 mcrypt gd gmp libevent zlib libzip bzip2 imagemagick pkg-config
brew link icu4c
brew link --force openssl
brew link --force libxml2

Following could happen :

dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /Users/abenevaut/.phpbrew/php/php-7.3.10/bin/php
  Reason: image not found

You have to :

ln -s /usr/local/opt/[email protected]/lib/libcrypto.1.0.0.dylib /usr/local/lib/ 
ln -s /usr/local/opt/[email protected]/lib/libssl.1.0.0.dylib /usr/local/lib/ 

@abenevaut
Copy link
Author

abenevaut commented May 5, 2020

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

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