Skip to content

Instantly share code, notes, and snippets.

@chalasr
Last active February 24, 2019 12:12
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 chalasr/a3db08e573d97499f8a0c604457c5324 to your computer and use it in GitHub Desktop.
Save chalasr/a3db08e573d97499f8a0c604457c5324 to your computer and use it in GitHub Desktop.
Build php 7.3 from source OSX

Checkout source

git clone https://github.com/php/php-src
cd php-src
git checkout php-7.3.0

Configure

./configure \
    --disable-cgi \
    --enable-mbstring \
    --enable-pcntl \
    --enable-soap \
    --enable-sockets \
    --enable-mysqlnd \
    --enable-zip \
    --with-zlib-dir=/usr/local/opt/zlib \
    --with-openssl=/usr/local/opt/openssl \
    --with-iconv=/usr/local/opt/libiconv \
    --with-pdo-mysql=mysqlnd \
    --with-curl \
    --with-sodium \
    --with-password-argon2

Cleanup the generated Makefile

Open the generated Makefile in your IDE. It should contain the following two lines:

EXTRA_LDFLAGS = -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/libiconv/lib -L/usr/local/Cellar/libsodium/1.0.16/lib
EXTRA_LDFLAGS_PROGRAM = -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/libiconv/lib -L/usr/local/Cellar/libsodium/1.0.16/lib

For both lines, remove the following entry: -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib

Build PHP binary

make -j 5

Enjoy

./sapi/cli/php -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment