in FreeBSD

How to Install Official PHP 7 release on FreeBSD 10.2

Finally  PHP 7 officialy released. I’m eager to see it again after already test it before (7.0.0 dev built on January 23 2015)

# freebsd-update fetch

Looking up mirrors… none found.
Fetching public key from… done.
Fetching metadata signature for 10.2-RELEASE from… failed.
No mirrors remaining, giving up.

# dig

dig: Command not found.

Fix it by install bind-tools

# pkg install bind-tools

Updating FreeBSD repository catalogue…
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    bind-tools: 9.10.3_1
    libxml2: 2.9.3
    libedit: 3.1.20150325_1
    idnkit: 1.0_5

The process will require 32 MiB more space.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching bind-tools-9.10.3_1.txz: 100%    2 MiB 310.1kB/s    00:08   
Fetching libxml2-2.9.3.txz: 100%  789 KiB 269.4kB/s    00:03   
Fetching libedit-3.1.20150325_1.txz: 100%  121 KiB 123.6kB/s    00:01   
Fetching idnkit-1.0_5.txz: 100%  194 KiB 198.5kB/s    00:01   
Checking integrity… done (0 conflicting)
[1/4] Installing libxml2-2.9.3…
[1/4] Extracting libxml2-2.9.3: 100%
[2/4] Installing libedit-3.1.20150325_1…
[2/4] Extracting libedit-3.1.20150325_1: 100%
[3/4] Installing idnkit-1.0_5…
[3/4] Extracting idnkit-1.0_5: 100%
[4/4] Installing bind-tools-9.10.3_1…
[4/4] Extracting bind-tools-9.10.3_1: 100%

Test it.

# dig

; <<>> DiG 9.10.3 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27825
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 3, ADDITIONAL: 0

;        IN    A

;; ANSWER SECTION:    599    IN    CNAME    599    IN    A

;; AUTHORITY SECTION:        599    IN    NS        599    IN    NS        599    IN    NS

;; Query time: 16 msec
;; WHEN: Sat Dec 05 16:55:49 WIB 2015
;; MSG SIZE  rcvd: 162

Now retry update FreeBSD.

[email protected]:/usr/home/alam # freebsd-update fetch

Looking up mirrors… none found.
Fetching metadata signature for 10.2-RELEASE from… failed.
No mirrors remaining, giving up.

Ok, I give up too 🙂

Time to use VPS from Vultr.

It took less than 5 minutes to start

Login now

 ssh [email protected]
The authenticity of host ‘ (’ can’t be established.
ECDSA key fingerprint is bb:93:1e:43:d5:2a:41:07:5c:0a:7b:8a:70:2a:60:f4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ (ECDSA) to the list of known hosts.
Password for [email protected]:
Last login: Tue Oct 27 18:44:11 2015 from
FreeBSD 10.2-RELEASE (GENERIC) #0 r286666: Wed Aug 12 15:26:37 UTC 2015

Welcome to FreeBSD!

Release Notes, Errata:
Security Advisories:
FreeBSD Handbook:
Questions List:
FreeBSD Forums:

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace “en” with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.

Update FreeBSD

Fetch latest update

# freebsd-update fetch

Looking up mirrors… 5 mirrors found.
Fetching metadata signature for 10.2-RELEASE from… done.
Fetching metadata index… done.
Fetching 2 metadata patches.. done.
Applying metadata patches… done.
Inspecting system… done.
Preparing to download files… done.
Fetching 5 patches… done.
Applying patches… done.

The following files will be updated as part of updating to 10.2-RELEASE-p7:

Install the update

# freebsd-update install

Installing updates… done.

Update pkg

# pkg update

The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+, please wait…
Verifying signature with trusted certificate… done
Installing pkg-1.6.1…
Extracting pkg-1.6.1: 100%
Message from pkg-1.6.1:
If you are upgrading from the old package format, first run:

# pkg2ng

Updating FreeBSD repository catalogue…
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01   
Fetching packagesite.txz: 100%    5 MiB   5.5MB/s    00:01   
Processing entries: 100%
FreeBSD repository update completed. 24617 packages processed.

Search for PHP package

# pkg search php | grep Language

mod_php5-5.4.45,1              PHP Scripting Language
mod_php55-5.5.30               PHP Scripting Language
mod_php56-5.6.14               PHP Scripting Language
php5-5.4.45                    PHP Scripting Language
php55-5.5.30                   PHP Scripting Language
php56-5.6.14                   PHP Scripting Language

Only PHP 5.4, 5.5 and 5.6 available. Continue with ports.

Install ports with Portsnap

Download snapshot

# portsnap fetch

Looking up mirrors… 7 mirrors found.
Fetching public key from… done.

Fetching snapshot tag from… done.
Fetching snapshot metadata… done.
Fetching snapshot generated at Sat Dec  5 00:03:05 UTC 2015:
e77ac916c3137b60907a8bc1a7d4e7fae5ca0bf35dcd8e100% of   70 MB   37 MBps 00m01s
Extracting snapshot… done.
Verifying snapshot integrity… done.
Fetching snapshot tag from… done.
Fetching snapshot metadata… done.
Updating from Sat Dec  5 00:03:05 UTC 2015 to Sat Dec  5 03:10:07 UTC 2015.
Fetching 4 metadata patches… done.
Applying metadata patches… done.
Fetching 0 metadata files… done.
Fetching 5 patches.
(5/5) 100.00%  done.                            
Applying patches…
Fetching 0 new ports or files… done.

Extract ports

# portsnap extract

Find PHP 7

# make search name=php70
# make search name=php7

I must wait for developer to get it from ports or pkg.

Install PHP 7 from source

# pkg install -y git autoconf bison libxml2 libxslt jpeg png libxpm freetype2 gmp libmcrypt mysql56-client aspell recode

# hash -r

# mkdir ~/tmp
# cd ~/tmp

# git clone
Cloning into ‘php-src’…
remote: Counting objects: 642977, done.
remote: Compressing objects: 100% (129159/129159), done.
remote: Total 642977 (delta 514316), reused 640981 (delta 512488)
Receiving objects: 100% (642977/642977), 160.98 MiB | 16.17 MiB/s, done.
Resolving deltas: 100% (514316/514316), done.
Checking connectivity… done.
Checking out files: 100% (17869/17869), done.

# cd php-src
# ./buildconf
buildconf: checking installation…
buildconf: autoconf version 2.69 (ok)
rebuilding aclocal.m4
rebuilding configure
rebuilding main/

Build it

# ./configure \
    –prefix=$HOME/tmp/usr \
    –with-config-file-path=$HOME/tmp/usr/etc \
    –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-mcrypt \
    –with-iconv \
    –with-gmp \
    –with-pspell \
    –with-gd \
    –with-jpeg-dir=/usr \
    –with-png-dir=/usr \
    –with-zlib-dir=/usr \
    –with-xpm-dir=/usr \
    –with-freetype-dir=/usr \
    –enable-gd-native-ttf \
    –enable-gd-jis-conv \
    –with-openssl \
    –with-gettext=/usr \
    –with-zlib=/usr \
    –with-bz2=/usr \
    –with-recode=/usr \


Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: main/php_config.h is unchanged
config.status: executing default commands


# make



Build complete.
Don’t forget to run ‘make test’.

# make install

Installing shared extensions:     /root/tmp/usr/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary:        /root/tmp/usr/bin/
Installing PHP CLI man page:      /root/tmp/usr/php/man/man1/
Installing phpdbg binary:         /root/tmp/usr/bin/
Installing phpdbg man page:       /root/tmp/usr/php/man/man1/
Installing PHP CGI binary:        /root/tmp/usr/bin/
Installing PHP CGI man page:      /root/tmp/usr/php/man/man1/
Installing build environment:     /root/tmp/usr/lib/php/build/
Installing header files:          /root/tmp/usr/include/php/
Installing helper programs:       /root/tmp/usr/bin/
  program: phpize
  program: php-config
Installing man pages:             /root/tmp/usr/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /root/tmp/usr/lib/php/
SSL certificate subject doesn’t match host
fetch: Authentication error
*** Error code 1

make: stopped in /root/tmp/php-src

Check it

# /root/tmp/usr/bin/php -v
PHP 7.1.0-dev (cli) (built: Dec  5 2015 03:59:38) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2015 Zend Technologies

Lol, looks like I get ‘edge’ version. Maybe I should use traditional tar.gz file 🙂

I keep that for other update as my student already wait for my class.