Install Drupal 8 with phpng (php next generation) on FreeBSD 10.1

After get success with php next generation (phpng) installation I decide to test it with real php script. Drupal came to my attention and I came with a plan of recipe :-)

  • Drupal 8 (at the moment its 8.0.0-beta4)
  • PHP 7.0.0-dev
  • Lighttpd
  • MariaDB 10

I still use Vultr as Vps provider since my adsl connection is sucks at the moment.

Lets get start

Install MariaDB 10

I use pkg approach than using source way that I did before.

Delete previous installed mysql client

# pkg info | grep mysql
mysql56-client-5.6.22 Multithreaded SQL database (client)
# pkg delete mysql56-client
Checking integrity… done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:

The operation will free 45 MB.

Proceed with deinstalling packages? [y/N]: y
[1/1] Deinstalling mysql56-client-5.6.22…
[1/1] Deleting files for mysql56-client-5.6.22: 100%

Install MariaDB 10 server and Client

# pkg install -y mariadb100-server mariadb100-client

Enable MariaDB from rc.conf

# echo 'mysql_enable=YES' >> /etc/rc.conf

Start MariaDB Service

# /usr/local/etc/rc.d/mysql-server start

Change MariaDB root password

# /usr/local/bin/mysql_secure_installation


In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Add new user for upcoming drupal installation

# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.0.15-MariaDB FreeBSD Ports

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> create database drupal;
Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> grant all privileges on drupal.* to drupal@localhost identified by ‘123456’ with grant option;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> exit

Compile phpng

I compile phpng using last post.

# mkdir $HOME/tmp/usr/etc

# /root/tmp/usr/etc/php.ini

add these lines


Install Lighttpd

# pkg install -y lighttpd
Updating FreeBSD repository catalogue…
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 2 packages will be affected (of 0 checked):

New packages to be INSTALLED:
lighttpd: 1.4.35_5
pcre: 8.35_2

The process will require 6 MB more space.
1 MB to be downloaded.
Fetching lighttpd-1.4.35_5.txz: 100% 215 KB 219.8k/s 00:01
Fetching pcre-8.35_2.txz: 100% 1 MB 1.1M/s 00:01
Checking integrity… done (0 conflicting)
[1/2] Installing pcre-8.35_2…
[1/2] Extracting pcre-8.35_2: 100%
[2/2] Installing lighttpd-1.4.35_5…
[2/2] Extracting lighttpd-1.4.35_5: 100%

Set Lighttpd run on boot

# echo 'lighttpd_enable=YES' >> /etc/rc.conf

Create document root

# mkdir -p /usr/local/www/data

# touch /usr/local/www/data/index.html

# echo 'tes' > /usr/local/www/data/index.html

Lighttpd Configuration


# ee /usr/local/etc/lighttpd/modules.conf

remove # sign in front of this line:

## FastCGI (mod_fastcgi)
include “conf.d/fastcgi.conf”

save the file.

# ee /usr/local/etc/lighttpd/conf.d/fastcgi.conf

Add these lines under “server.modules += ( “mod_fastcgi” ) ” : source.

fastcgi.server = ( “.php” => ((
“bin-path” => “/root/tmp/usr/bin/php-cgi”,
“socket” => “/tmp/php.socket”,
“max-procs” => 2,
“bin-environment” => (
“bin-copy-environment” => (
“broken-scriptfilename” => “enable”

Enable fastcgi

Make sure output of

# /root/tmp/usr/bin/php-cgi -v

PHP 7.0.0-dev (cgi-fcgi) (built: Jan 23 2015 04:55:05)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.8.0-dev, Copyright (c) 1998-2014 Zend Technologies

cgi-fcgi means fast cgi enabled.

Testing phpinfo()

# echo "<?php phpinfo();?>" > /usr/local/www/data/info.php

See it from browser.



Fix Lighttpd error message

(network.c.283) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address; your config will break if the kernel default for IPV6_V6ONLY changes

That message show up when lighttpd restart.


Install Drupal 8

I’ll continue it next time :-)

How to install phpng aka php7 on FreeBSD 10

FreeBSD Mug

Update : I already try official PHP 7 and wrote it here (using git) and there (using tar.gz file)

FreeBSD Mug by wsinetworks

I just curious about php next generation aka phpng aka php7 . After a few times fail with hhvm ( FreeBSD hhvm and DragonFlyBSD hhvm) I think I need to test something different for my lab experiment :-)

The choice came to phpng and with the help from Vultr I can cure my curiosity in fast deployment. Well,

I use this configuration :

VPS location : Germany (Frankfurt), Europe.


FreeBSD version : FreeBSD 10 64 bit


Specs : 1 cpu, 768 MB memory, 15 GB storage and 1000 GB transfer.


Great, Hit ‘Place Order’ button and I can test it.

Steps :

Most of step taken from wiki of phpng.

1. Log in to server using ssh


read more »

Rebuild Fedora as Server using VPS and custom iso

Today task is little different. Old php script that run on PHP 5.2.9 and utilize mysql 5.0.88 need to rebuild in other place. That way another group of developer can add or inspect why new injected code can behave odd in such environment (they already try new code using newer PHP and it work well).

As far I can see from server log in message its Fedora 10 and using old PHP and old Mysql version. I need to replicate it in some place. Where we (I and developer) can log in and see it together.

Target for this server is same php and same mysql version :

#rpm -qa | grep php


# rpm -qa | grep mysql


VPS is my option  and Vultr (I choose $5/month specs that come with 15GB SSD storage and 768MB memory) can help me for this case .

Log in to Vultr and upload iso

  1. For Fedora 10 64 bit click here.
  2. For Fedora 10 32 bit click here.

Since I need to replicate it with minimum hassle I decide to use 64 bit in DVD format.

Create Server

After iso file successfully uploaded then I Choose custom iso selected Fedora 10 file.

fedora10_vps : virtual iso

After hit ‘deploy server’ wait for moment to take control.

Install Fedora Server in VPS

In case you see ipxe message in ‘console’ then you must make sure iso file attached. Check from virtual iso menu. If it’s not then select Fedora images and click ‘attach iso and reboot’ button.

fedora10_vps2 : attach iso


This view is the right one.

fedora10_vps3 : remove attached iso

Go back to manage server menu and choose ‘console’ link. If you see this then iso attach process working well.

fedora10_vps4 : install serverThe rest of installation step is as usual.

For partition I choose to use all disk space.

fedora10_server5 : web server chosen etcWeb server and repositories (installation repo, Fedora 10 -x86_64 and updates).

Reboot and configure it for first time as usual till you see this view (already login)

fedora10_vps6 : successfully installed

Disable GUI login and X-Window on Fedora

Yes, of course its server. No X windows please :-)

Open terminal from console and edit /etc/inittab and change this line :





In this stage also make sure to remove iso from custom iso menu for this server.

After server reboot you’ll see no more X-Window.


Control Fedora Server using ssh

By default ssh server already installed and running. Vultr system will make sure right ip assigned for this VPS and you just need to access it from ipv4 provided.



free -m

# free -m
total used free shared buffers cached
Mem: 748 169 578 0 6 57
-/+ buffers/cache: 105 642
Swap: 1503 0 1503

# df -H
Filesystem Size Used Avail Use% Mounted on
15G 3,4G 10G 26% /
/dev/vda1 200M 15M 175M 8% /boot
tmpfs 393M 0 393M 0% /dev/shm

Check PHP

# rpm -qa | grep php


Check MySQL

# rpm -qa | grep mysql


I can see the result is different. I use 64 bit while existing server use 32 bit and few extension not installed. In general Vultr can help me rebuild the server. I just need to more careful and diligent :-)

# yum install php-gd php-mcrypt php-mbstring php-pecl-apc mysql-server

For iptables etc remain same as Install PHP 5.2.17 on CentOS 5.10.

For Selinux case I prefer to disable it :

# nano /etc/selinux/config

change enforcing to disabled .


Compile HHVM 3.4 on DragonFlyBSD 4

My last experiment with HHVM is testing compile it with HHVM LTS (its version 3.3) on FreeBSD 10. Since HHVM 3.4 is out I think I’ll try it again with FreeBSD 10 but since I just install DragonFlyBSD 4 then I think I’ll give it try.

Another reason is I just curious to see implementation of DragonFlyBSD in many field. By share it to others perhaps I can contribute too.

Ok, lets go back to topic.

I use DragonFlyBSD 4 that I install recently. It has 2 cpu and memory 2GB plus hammer filesystem enabled.

See current installed package

# pkg info
bind-tools-9.10.1_3 BIND DNS suite with updated DNSSEC and DNS64
ca_root_nss-3.17.2_1 The root certificate bundle from the Mozilla Project
cdrtools-3.00_2 CD/DVD/BluRay and ISO-9660 image creation and extraction tools
curl-7.38.0_2 Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
cvsps-2.1_1 Create patchset information from CVS
expat-2.1.0_1 XML 1.0 parser written in C
gettext- GNU gettext package
git-2.1.2 Distributed source code management tool
idnkit-1.0_5 Library to handle internationalized domain names
indexinfo-0.2 Utility to regenerate the GNU info page index
isc-dhcp42-server-4.2.7 The ISC Dynamic Host Configuration Protocol server
libxml2-2.9.2_2 XML parser library for GNOME
openssl-1.0.1_16 SSL and crypto library
pkg-1.3.8_3 Package manager

read more »

DragonFlyBSD 4.0.1 and VirtualBox Bridge

After success configure teamviewer 10 on my peppermint os 5 I continue with Virtualbox. No problem here and I can get virtualbox running. Another task I try to accomplish is testing newest DragonFlyBSD (its 4.0.1) that only available in 64 bit.

Everything is smooth except nat section on my virtualbox. I can not connect to internet but I can ping to host.

Being curious I decide to test ‘bridge’ connection via wireless connection.


I activate portable hotspot using my Xiaomi Red 1s .

Checking ip address of host

$ ifconfig wlan0

wlan0 Link encap:Ethernet HWaddr 38:b1:db:ec:d1:a1
inet addr: Bcast: Mask:
inet6 addr: fe80::3ab1:dbff:feec:d1a1/64 Scope:Link
RX packets:8786 errors:0 dropped:0 overruns:0 frame:5364
TX packets:9104 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4774804 (4.7 MB) TX bytes:2067642 (2.0 MB)

Well, I can use as ip address.

For gateway find it out by trace route

$ traceroute
traceroute to (, 30 hops max, 60 byte packets
1 ( 3.269 ms 4.229 ms 5.127 ms
2 * * *
3 * * *
4 * * *

Great. Gateway located in

Last information needed for my dragonflybsd is nameserver.

I use google dns ( for that purpose.

Lets configure Ip address on dragonlybsd 4.0.1 box

# ifconfig em0 inet

# route add default

# echo 'nameserver' > /etc/resolv.conf


Last step is configure sshd_config for allow ssh access as I do previously.

Try ssh now from my linux box.

$ ssh alam@
The authenticity of host ‘ (’ can’t be established.
ECDSA key fingerprint is b0:7e:40:28:5a:d6:10:e0:7f:f7:58:a6:30:21:47:47.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘’ (ECDSA) to the list of known hosts.
alam@’s password:
Last login: Fri Jan 2 11:26:41 2015
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.

DragonFly v4.0.0.32.gce3e27-RELEASE (X86_64_GENERIC) #25: Mon Nov 24 20:15:26 PST 2014

Welcome to DragonFly!

dports/net/netcat package is useful not only for redirecting input/output
to TCP or UDP connections, but also for proxying them. See inetd(8) for


uname -a

DragonFly 4.0-RELEASE DragonFly v4.0.0.32.gce3e27-RELEASE #25: Mon Nov 24 20:15:26 PST 2014 x86_64


load averages: 0.00, 0.00, 0.00; up 0+00:27:33 11:53:20
21 processes: 1 running, 21 active
CPU states: 0.0% user, 0.0% nice, 4.1% system, 0.0% interrupt, 95.8% idle
Memory: 12M Active, 2252K Inact, 137M Wired, 105M Buf, 1798M Free
Swap: 4096M Total, 4096M Free

1080 alam 0 14M 2196K CPU0 0 0:00 0:00 0.10% top
1002 root 0 15M 2904K ttyin 1 0:00 0:00 0.00% csh
867 root 0 18M 3592K kqread 0 0:00 0:00 0.00% sendmail
979 alam 0 15M 2916K pause 0 0:00 0:00 0.00% tcsh
971 root 0 38M 1796K wait 1 0:00 0:00 0.00% login
1074 alam 0 15M 2888K pause 0 0:00 0:00 0.00% tcsh
1071 root 0 30M 4156K kqread 0 0:00 0:00 0.00% sshd
999 alam 0 38M 1912K wait 1 0:00 0:00 0.00% su
518 root 0 6532K 1148K kqread 0 0:00 0:00 0.00% syslogd
870 smmsp 0 17M 3404K pause 1 0:00 0:00 0.00% sendmail
977 root 0 6900K 1308K ttyin 1 0:00 0:00 0.00% getty
974 root 0 6900K 1308K ttyin 0 0:00 0:00 0.00% getty
894 root 0 9528K 1236K nanslp 1 0:00 0:00 0.00% cron
975 root 0 6900K 1308K ttyin 1 0:00 0:00 0.00% getty
976 root 0 6900K 1308K ttyin 0 0:00 0:00 0.00% getty
973 root 0 6900K 1308K ttyin 1 0:00 0:00 0.00% getty
978 root 0 6900K 1308K ttyin 0 0:00 0:00 0.00% getty
972 root 0 6900K 1308K ttyin 0 0:00 0:00 0.00% getty
1073 alam 0 30M 2740K kqread 1 0:00 0:00 0.00% sshd
853 root 0 27M 1592K kqread 0 0:00 0:00 0.00% sshd
452 root 0 5928K 628K kqread 0 0:00 0:00 0.00% devd


df -H

Filesystem Size Used Avail Capacity Mounted on
ROOT 80G 1.2G 79G 1% /
devfs 1.0k 1.0k 0B 100% /dev
/dev/serno/VB1831c6f3-9ab76793.s1a 793M 122M 608M 17% /boot
/pfs/@@-1:00001 80G 1.2G 79G 1% /var
/pfs/@@-1:00002 80G 1.2G 79G 1% /tmp
/pfs/@@-1:00003 80G 1.2G 79G 1% /usr
/pfs/@@-1:00004 80G 1.2G 79G 1% /home
/pfs/@@-1:00005 80G 1.2G 79G 1% /usr/obj
/pfs/@@-1:00006 80G 1.2G 79G 1% /var/crash
/pfs/@@-1:00007 80G 1.2G 79G 1% /var/tmp
procfs 4.1k 4.1k 0B 100% /proc


cat /etc/fstab

# Device Mountpoint FStype Options Dump Pass#
/dev/serno/VB1831c6f3-9ab76793.s1a /boot ufs rw 1 1
/dev/serno/VB1831c6f3-9ab76793.s1b none swap sw 0 0
/dev/serno/VB1831c6f3-9ab76793.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

gcc version

gcc -v
Using built-in specs.
Target: x86_64-pc-dragonflybsd
Configured with: DragonFly/x86_64 system compiler (c, c++, objc, LTO)
Thread model: posix
gcc version 4.7.4 [DragonFly] Release/2014-06-12

Check CPU information

sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
hw.machine: x86_64
hw.model: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
hw.ncpu: 2
hw.machine_arch: x86_64


To make configuration permanent (ip address)

Switch to root first before edit rc.conf (I already add alam user with group wheel)

# ee /etc/rc.conf

# Basic rc.conf, adjust according to your needs
dumpdev=”/dev/serno/VB1831c6f3-9ab76793.s1b” # via installer configuration
ifconfig_em0=”DHCP” # via installer configuration
#add permanent ip address after comment ifconfig_em0 line

ifconfig_em0=”inet netmask″

save the file by hit esc key and choose save option.

Next step is try hhvm on DragonFlyBSD :-)