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 Homebrew/install/master/install)”

Step 2. Dependencies Install

Use the following command to install dependencies
brew install

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
cd php-src
./buildconf –force
env YACC=`brew –prefix bison27`/bin/bison ./configure
–with-freetype-dir=`brew –prefix freetype`
–with-gettext=`brew –prefix gettext`
–with-jpeg-dir=`brew –prefix gd`
–with-mcrypt=`brew –prefix mcrypt`
–with-mysqli=`brew –prefix`/bin/mysql_config
–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
–root phpng-pkg
–identifier net.php.phpng
–version 7.0.0-dev
–ownership recommended
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.

PHP Team Lead,
Mallow Technologies.

Leave a Comment

Your email address will not be published. Required fields are marked *