Installation of PHP 7.0(PHPNG) in Mac OS X

In the continuation of my preceding blog now I have shared about “How to install PHP 7.0”  which is also known as PHPNG indicating the “Next Generation” of PHP.
This blog will help you to install PHP 7.0 in Mac OS X

Step 1. Install Brew

Install Brew so that you can install additional dependencies with the support of it.
Open Terminal and in the prompt paste the below command
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/ Homebrew/install/master/install)”

Step 2. Dependencies Install

Use the following command to install dependencies
brew install
autoconf
automake
bison27
freetype
gd
gettext
git
mariadb
mcrypt
t1lib
zlib

Step 3. Building PHP 7.0  from source

We need to clone the PHP-7.0.0 branch of the PHP source and compile it using the build script.
git clone -b PHP-7.0.0 https://github.com/php/php-src.git
cd php-src
./buildconf –force
env YACC=`brew –prefix bison27`/bin/bison ./configure
–prefix=”/usr/local/opt/phpng”
–with-config-file-path=”/usr/local/etc/phpng”
–enable-bcmath
–enable-calendar
–enable-exif
–enable-ftp
–enable-gd-native-ttf
–enable-gd-jis-conv
–enable-mbstring
–enable-pcntl
–enable-sysvmsg
–enable-sysvsem
–enable-sysvshm
–enable-wddx
–enable-zip
–with-bz2
–with-curl
–with-iconv
–with-freetype-dir=`brew –prefix freetype`
–with-gd
–with-gettext=`brew –prefix gettext`
–with-gmp
–with-jpeg-dir=`brew –prefix gd`
–with-mcrypt=`brew –prefix mcrypt`
–with-mysqli=`brew –prefix`/bin/mysql_config
–with-openssl
–with-pdo-mysql=`brew –prefix mariadb`
–with-png-dir=`brew –prefix gd`
–with-zlib=`brew –prefix zlib`
make -j`sysctl -n hw.logicalcpu_max`

Step 4. Creating a package installer

We can complete the installation by creating a package installer
env INSTALL_ROOT=$PWD/phpng-pkg make install
pkgbuild
–root phpng-pkg
–identifier net.php.phpng
–version 7.0.0-dev
–ownership recommended
phpng-dev.pkg
open phpng-dev.pkg

Step 5. Use PHPNG

By default MAC OS X will use the PHP binary located at /usr/bin/php which belongs to PHP 5.5. To make PHPNG take precedence we need to symlink to /usr/local/bin directory. After that You can make sure that you are having the correct version running by php –v.
Hope you have learnt the new PHP 7.0 which has 100% increase in performance.

In my next blog, “The features of AWS in a nutshell and how to reduce billing cost” which will make make a start up to use Cloud services without the fear of technology or expense.

Vijayanand,
PHP Team Lead,
Mallow Technologies.

Leave a Reply

%d bloggers like this: