in DragonFy BSD

Building and Testing PHP 7 under DragonFlyBSD 4.0.5

DragonFlyBSD 4.0.5 is waiting for me to test it 🙂 . I love it for several factors :

  • Size; its iso file is light in size (only 200MB + in bz2 form)
  • Learning curve; no need to learn much as I’m familiar with FreeBSD 🙂

As I already try PHP7 in FreeBSD before :

  1. Install PHP 7 akan phpng on FreeBSD 10
  2. Using PHP 7 with lighttpd on FreeBSD 10

I want to test it in DragonFly BSD with nginx as web server. This time  I use virtualbox and I try Hammer File system (make sure to have minimum 50 GB in disk size to usse Hammer File System in DragonFly BSD).

dflybsd405_hammer

With 60 GB in disk size and 2GB memory allocated to this virtual machine I’ll try PHP 7.

dflybsd405_specs

Installation step is no different like before.

dflybsd405_user

 

DHCP for sure 🙂

dflybsd405_dhcp

Reboot it and change boot order to get start with next steps :

Login via ssh

$ ssh [email protected] -p 2222
The authenticity of host ‘[127.0.1.1]:2222 ([127.0.1.1]:2222)’ can’t be established.
ECDSA key fingerprint is bd:e0:2a:f5:44:86:8d:5a:cd:2a:56:26:6a:f1:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘[127.0.1.1]:2222’ (ECDSA) to the list of known hosts.
Permission denied (publickey).

Ups, I forgot to configure ssh server first after as post installation step in DragonFly BSD.

Retry login

$ ssh [email protected] -p 2222
[email protected]’s password:
Last login: Fri Jun 12 11:29:12 2015
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

DragonFly v4.0.5-RELEASE (X86_64_GENERIC) #29: Sun Mar 22 17:42:50 PDT 2015

Welcome to DragonFly!

Need to see the calendar for this month? Simply type “cal”. To see the
whole year, type “cal -y”.
— Dru <[email protected]>
>

Looking around for hammer

# ps ax | grep hammer
-1 ?? B0L 0:00.00 (hammer-S3)
-1 ?? B0L 0:00.00 (hammer-S2)
-1 ?? B0L 0:00.01 (hammer-S1)
-1 ?? B0L 0:00.01 (hammer-S0)
-1 ?? B0L 0:00.01 (hammer-M)

# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/serno/VBb247cd88-d6dc6e95.s1a /boot ufs rw 1 1
/dev/serno/VBb247cd88-d6dc6e95.s1b none swap sw 0 0
/dev/serno/VBb247cd88-d6dc6e95.s1d / hammer rw 1 1
/pfs/var /var null rw 0 0
/pfs/tmp /tmp null rw 0 0
/pfs/usr /usr null rw 0 0
/pfs/home /home null rw 0 0
/pfs/usr.obj /usr/obj null rw 0 0
/pfs/var.crash /var/crash null rw 0 0
/pfs/var.tmp /var/tmp null rw 0 0
proc /proc procfs rw 0 0

Well. Everything is on the right place 🙂

Lets get start install PHP 7 on DragonFly BSD :

# pkg update
Updating Avalon repository catalogue…
pkg: http://mirror-master.dragonflybsd.org/dports/dragonfly:4.0:x86:64/LATEST/meta.txz: No address record
pkg: repository Avalon has no meta file, using default settings
pkg: http://mirror-master.dragonflybsd.org/dports/dragonfly:4.0:x86:64/LATEST/packagesite.txz: No address record
pkg: Unable to update repository Avalon

Ups, looks like Avalon is not available at the moment.

My bad, I find out that nameserver is not work. Add Google public dns server.

# cat /etc/resolv.conf
nameserver 127.0.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Retry pkg update :

# pkg update
Updating Avalon repository catalogue…
Fetching meta.txz: 100% 264 B 0.3kB/s 00:01
Fetching packagesite.txz: 100% 4 MiB 138.8kB/s 00:34
Processing entries: 100%
Avalon repository update completed. 22075 packages processed

Install supported packages

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

# mkdir ~/tmp

# cd ~/tmp

This step taken from wiki.

Clone PHP 7 from git

# git clone https://git.php.net/repository/php-src.git
Cloning into ‘php-src’…
remote: Counting objects: 624731, done.
remote: Compressing objects: 100% (132747/132747), done.
Receiving objects: 99% (622842/624731), 154.49 MiB | 156.00 KiB/s
remote: Total 624731 (delta 499933), reused 614596 (delta 490658)
Receiving objects: 100% (624731/624731), 154.80 MiB | 113.00 KiB/s, done.
Resolving deltas: 100% (499933/499933), done.
Checking connectivity… done.
Checking out files: 100% (17441/17441), done.

Build  and compile PHP 7

# cd php-src

# ./buildconf
buildconf: checking installation…
buildconf: autoconf version 2.69 (ok)
rebuilding aclocal.m4
rebuilding configure
rebuilding main/php_config.h.in

# ./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 \
    --with-t1lib=/usr \
    --enable-gd-native-ttf \
    --enable-gd-jis-conv \
    --with-openssl \
    --with-mysql=/usr \
    --with-pdo-mysql=/usr \
    --with-gettext=/usr \
    --with-zlib=/usr \
    --with-bz2=/usr \
    --with-recode=/usr \
    --with-mysqli=/usr/bin/mysql_config

I got error this time :

mysql_config not found

configure: error: Please reinstall the mysql distribution

# whereis mysql_config
mysql_config: /usr/local/bin/mysql_config /usr/local/man/man1/mysql_config.1.gz

Change config option of mysql_config from –with-mysqli=/usr/bin/mysql_config to –with-mysqli=/usr/local/bin/mysql_config

Retry again and got another error :

configure: error: PDO_MYSQL configure failed, MySQL 4.1 needed. Please check config.log for more information.

I don’t get this error in previous install.

Since I don’t use PDO then I remove the option from config.

Retry again and got this error:

configure: error: I cannot link librecode (-L/usr/local/lib -lrecode). Is it installed?

Well, force recode to static also not work. I remove it too from config option.

After a few try I got this options work :

# ./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-mysqli=/usr/local/bin/mysql_config

…………….

………………..

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

# make install
Installing shared extensions: /root/tmp/usr/lib/php/extensions/no-debug-non-zts-20141001/
Installing PHP CLI binary: /root/tmp/usr/bin/
Installing PHP CLI 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/

Well, I don’t use PEAR so last options change to :

# ./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-mysqli=/usr/local/bin/mysql_config –without-pear

# make

# make install

# make install
Installing shared extensions: /root/tmp/usr/lib/php/extensions/no-debug-non-zts-20141001/
Installing PHP CLI binary: /root/tmp/usr/bin/
Installing PHP CLI 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
/root/tmp/php-src/build/shtool install -c ext/phar/phar.phar /root/tmp/usr/bin
ln -s -f phar.phar /root/tmp/usr/bin/phar
Installing PDO headers: /root/tmp/usr/include/php/ext/pdo/

Test

# /root/tmp/usr/bin/php -v
PHP 7.0.0-dev (cli) (built: Jun 12 2015 14:16:06)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
# /root/tmp/usr/bin/php-cgi -v
PHP 7.0.0-dev (cgi-fcgi) (built: Jun 12 2015 14:16:21)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies

Create php.ini

# mkdir $HOME/tmp/usr/etc

# ee $HOME/tmp/usr/etc/php.ini

Enter these lines :

max_execution_time=600
memory_limit=128M
error_reporting=0
display_errors=0
log_errors=0
user_ini.filename=
realpath_cache_size=2M
cgi.check_shebang_line=0

zend_extension=opcache.so
opcache.enable_cli=1
opcache.save_comments=0
opcache.fast_shutdown=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.use_cwd=1
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.consistency_checks=0

Recheck for Zend Opcache

# /root/tmp/usr/bin/php-cgi -v
PHP 7.0.0-dev (cgi-fcgi) (built: Jun 12 2015 14:16:21)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

Great, now install nginx :

# pkg install nginx
Updating Avalon repository catalogue…
Avalon repository is up-to-date.
All repositories are up-to-date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
nginx: 1.8.0_1,2
pcre: 8.37_1

The process will require 6 MiB more space.
1 MiB to be downloaded.

Proceed with this action? [y/N]: y

Fetching nginx-1.8.0_1,2.txz: 100% 269 KiB 55.0kB/s 00:05
Fetching pcre-8.37_1.txz: 100% 1 MiB 90.0kB/s 00:12
Checking integrity… done (0 conflicting)
[1/2] Installing pcre-8.37_1…
[1/2] Extracting pcre-8.37_1: 100%
[2/2] Installing nginx-1.8.0_1,2…
===> Creating users and/or groups.
Using existing group ‘www’.
Using existing user ‘www’.
[2/2] Extracting nginx-1.8.0_1,2: 100%

I’ll continue soon.