Skip to content

Instantly share code, notes, and snippets.

@denji
Forked from kitsunet/configure
Last active March 1, 2023 12:07
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save denji/8e50fcb13482c5d6c78a to your computer and use it in GitHub Desktop.
Save denji/8e50fcb13482c5d6c78a to your computer and use it in GitHub Desktop.

Quick install PHP 7.0:

1. Install depends PHP 7.0
$ brew install autoconf automake gmp homebrew/versions/bison27 gd freetype t1lib gettext zlib mcrypt
2. Configure PHP 7.0
$ git clone --depth=1 https://github.com/php/php-src.git
$ cd php-src
$ ./buildconf
$ env YACC=`brew --prefix bison27`/bin/bison ./configure \
    --prefix="/usr/local/opt/php7" \
    --with-config-file-path="/usr/local/etc/php7" \
    --enable-mbstring \
    --enable-zip \
    --enable-bcmath \
    --enable-pcntl \
    --enable-ftp \
    --enable-exif \
    --enable-calendar \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    --enable-wddx \
    --with-curl \
    --with-iconv \
    --with-gmp \
    --with-gd \
    --with-jpeg-dir=`brew --prefix gd` \
    --with-png-dir=`brew --prefix gd` \
    --with-freetype-dir=`brew --prefix freetype` \
    --with-t1lib=`brew --prefix t1lib` \
    --enable-gd-native-ttf \
    --enable-gd-jis-conv \
    --with-openssl \
    --enable-mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-mysql-sock=/tmp/mysql.sock \
    --with-gettext=`brew --prefix gettext` \
    --with-zlib=`brew --prefix zlib` \
    --with-bz2 \
    --with-mcrypt=`brew --prefix mcrypt`
$ make -j `sysctl -n hw.logicalcpu_max`
$ open -R .

Optional. Deploy OSX package (First step 2 finish)

$ env INSTALL_ROOT=$PWD/php7-pkg make install
$ pkgbuild \
  --root php7-pkg \
  --identifier org.denji.php7 \
  --version 7.0.0 \
  --ownership recommended \
  PHP-7.0.0.pkg
$ open -R PHP-7.0.0.pkg

Install PHP 7.0 to /usr/local/opt/php7

$ make install

Uninstall PHP 7.0

$ rm -rvf "/usr/local/opt/php7"
$ rm -rvf "/usr/local/etc/php7"

TODO

  1. export php.ini-{development,production}, php-fpm.ini, extensions ini, php.ini, fpm srcipt launchd in /usr/local/etc/php7/

Links

2014-09-26 10 36 56

@vus520
Copy link

vus520 commented Dec 4, 2015

if you don't find formula with brew install bison27 then you need try this

brew install homebrew/versions/bison27

@dprevite
Copy link

If you run into a BZip2 error like this configure: error: Please reinstall the BZip2 distribution just run xcode-select --install and try again.

On El Capitan you may also get errors similar to fatal error: 'openssl/ssl.h' file not found, for this run brew link openssl --force and try again.

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