Install PHP 7 and Apache22 on DragonFlyBSD 4.2.4


Limited Time Promo, Get Free $20 credit from Vultr, click the banner to get it.

Using current machine but get faster performance by only upgrade software is a good offer. That feel happen to me when I hear about php 7 release. Being curious I decide to use latest dragonflybsd (at this moment 4.2.4) as pilot project for new hosting infrastructure platform.

Lets get start!

# uname -a

DragonFly php7.hostingformula.net 4.2-RELEASE DragonFly v4.2.4-RELEASE #6: Sun Aug 9 13:25:14 EDT 2015 [email protected]:/usr/obj/home/justin/release/4_2/sys/X86_64_GENERIC x86_64

# pkg info

bind-tools-9.10.2P3 Command line tools from BIND: delv, dig, host, nslookup…
ca_root_nss-3.19.2 Root certificate bundle from the Mozilla Project
cdrtools-3.00_2 CD/DVD/BluRay and ISO-9660 image creation and extraction tools
curl-7.43.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_2 XML 1.0 parser written in C
gettext-runtime-0.19.4 GNU gettext runtime libraries and programs
git-2.4.6 Distributed source code management tool
idnkit-1.0_5 Library to handle internationalized domain names
indexinfo-0.2.3 Utility to regenerate the GNU info page index
isc-dhcp42-server-4.2.8_1 ISC Dynamic Host Configuration Protocol server
krb5-1.13.2_2 Authentication system developed at MIT, successor to Kerberos IV
libxml2-2.9.2_3 XML parser library for GNOME
pkg-1.5.5 Package manager

Install Apache2 and friends

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

Download PHP 7

Get from nearest mirror here.

#wget http://au1.php.net/get/php-7.0.0.tar.bz2/from/this/mirror

extract

# tar xvjf mirror

# cd php-7.0.0/

Configure

# ./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 \
–with-apxs2

# make

# make install

………………..

…………………….

[activating module `php7′ in /usr/local/etc/apache22/httpd.conf]
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/

Great.

Check from CLI

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

PHP 7.0.0 (cgi-fcgi) (built: Dec 8 2015 13:58:47)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

Configure Apache and PHP 7

enable apache22

# echo ‘apache22_enable=”YES”‘ >> /etc/rc.conf

Add PHP 7 directive on Apache22 configuration

# ee /usr/local/etc/apache22/httpd.conf

Make sure these lines exist in httpd.conf

LoadModule php7_module        libexec/apache22/libphp7.so

…………………

…………………

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

…………………

………………..

<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig etc/apache22/mime.types
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

save the file.

Start Apache22

# /usr/local/etc/rc.d/apache22 start

Testing

Add info.php

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

Open web browser and type location/ip adress/info.php

php7

Nice. I have install PHP 7 on my dragonflybsd box 🙂


Limited Time Promo, Get Free $20 credit from Vultr, click the banner to get it.