-
-
Save jbanety/35d01689608ad89777d349f65c7b39c9 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
PHP_VERSION=7.4.2 | |
# Command lines tools | |
xcode-select --install | |
# Install dependencies | |
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5 | |
# Dirs | |
mkdir -p /Applications/MAMP/bin/php/php$PHP_VERSION/include | |
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include | |
# Download PHP 7 sources | |
wget http://fr2.php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror -O php-$PHP_VERSION.tar.bz2 | |
# Extract | |
tar -xjvf php-$PHP_VERSION.tar.bz2 | |
mv php-$PHP_VERSION php | |
# Configure PHP | |
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include/php/php-$PHP_VERSION | |
PKG_CONFIG=/usr/local/opt/pkg-config/bin/pkg-config PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/krb5/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig YACC=/usr/local/opt/bison/bin/bison ./configure --prefix=/Applications/MAMP/bin/php/php$PHP_VERSION --exec-prefix=/Applications/MAMP/bin/php/php$PHP_VERSION --sysconfdir=/Applications/MAMP/bin/php/php$PHP_VERSION/conf --with-config-file-path=/Applications/MAMP/bin/php/php$PHP_VERSION/conf --enable-gd --with-jpeg --with-zlib --with-zlib-dir=/usr/local/opt/lzlib --enable-ftp --with-bz2=/usr/local/opt/bzip2 --with-ldap --with-mysqli=mysqlnd --enable-mbstring=all --with-curl=/usr/local/opt/curl --enable-sockets --enable-bcmath --with-imap=shared,/usr/local/opt/imap-uw --enable-soap --with-kerberos --enable-calendar --with-pgsql=shared,/usr/local/opt/postgresql --enable-exif --with-gettext=shared,/usr/local/opt/gettext --with-xsl=/usr/local/opt/libxslt --with-pdo-mysql=mysqlnd --with-pdo-pgsql=shared,/usr/local/opt/postgresql --with-openssl=/usr/local/opt/openssl --with-iconv=/usr/local/opt/libiconv --enable-opcache --enable-intl --with-tidy=/usr/local/opt/tidy-html5 --with-readline=/usr/local/opt/readline --with-mhash --with-ldap=/usr/local/opt/openldap | |
# Add MAMP's PHP binaries to PATH | |
export PATH=/Applications/MAMP/bin/php/php$PHP_VERSION/bin/:$PATH | |
# Phpize | |
cd /Applications/MAMP/bin/php/php$PHP_VERSION/include/php/php-$PHP_VERSION/ext/pcntl | |
phpize | |
# Build | |
./configure | |
make | |
# Install ext | |
cp modules/pcntl.so /Applications/MAMP/bin/php/php$PHP_VERSION/lib/php/extensions/$(ls /Applications/MAMP/bin/php/php$PHP_VERSION/lib/php/extensions) | |
echo "extension=pcntl.so" >> /Applications/MAMP/bin/php/php$PHP_VERSION/conf/php.ini |
There are a couple updates needed here:
-
homebrew/dupes was deprecated, so the dependencies here shouldn't include 'homebrew/dupes/libiconv'
Linuxbrew/brew#701 -
The "# Configure PHP" step does not quite work because this directory is not present:
/Applications/MAMP/bin/php/php7.1.1/include/php/php-7.1.1
--> the configure executable is in /Applications/MAMP/bin/php/php7.1.1/include/php though
Worked like a charm. Thanks!
Worked with php 7.3.1. Thanks a lot! 👍
It worked. Thanks for the help.
Thanks! Worked with PHP 7.4
Hi, I updated the script to work with latest MAMP PHP version (7.4.2)
wow perfect, thank you!
thanks worked on php 7.4.1 !
worked like a charm for php 7.4.2!
Amazing!
You can download the precompiled extensions from here https://github.com/khanakiaphp/mamp_extensions
Beatiful. Thanks
Has anyone done this for PHP8?
Worked with php 7.3.33. Thanks a lot! 👍👍👍
Worked with php 7.2.14. Thanks a lot!