How to Install Apache PHP7 and MariaDB on FreeBSD12


Some People are  calling this FAMP because its related to install  Apache PHP and Mysql on  Freebsd instead of Linux.  let me guide you in this  installation of FAMP on my   local FreeBSD 12 just  released today .

My FreeBSD have IP

First  Updates all your FreeBSD  ports

1-Install apache  on FreeBSD12

the package installer of FreeBSD is  pkg

install  with this  comand

enable the daemon system-wide in FreeBSD.

Start Apache

Check  the status 

Apche24 root Directory is /usr/local/www/apache24/data you can edit the index.html to anything you want like my example bellow.

Please browse to the host : http://ip or http://fqdn

2-Install PHP7 on FreeBSD12

you have two ways to install PHP7

Install php 7 via  Ports

Also do the same for the  php extensions  but to avoid any dependencies issues i will advice to install php from the pkg manager

install php7 via package manager on FreeBSD 12  

Find latest php7  release from FreeBSD repositories

seach for the latest release from repo. for now is php72  is the latest release i think  php73 will be sonn pushed to the repo

Install  php72  and some  needed  pjp  modules  on FreeBSD 12

you see i’m using php71-mycript because the version 72  is not yet released  till today

to make php  working with apache we need extra php file configuration  (/usr/local/etc/apache24/Includes/php.conf)  with  this  content

How to test the PHP configuration.

Please do the  follow  command

Now restart  apache  and  checlk  http://ip/info.php


Looks good 🙂

3-Install MariaDB on FreeBSD12

Now we will continue using the binary package method

Install Mariadb server and client

pkg install mariadb103-server-10.3.11 mariadb103-client-10.3.11 php72-mysqli1 php72-mysqli

Enable MariaDB server system-wide and start the database daemon

Configure and set root  mysql password 

You are  Done.

Please  login to see if your root password is working.

Sockstat command

This Sockstat will show you  all  connection listening  on Ipv4

Spread the love
  • 8

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.


Please enter your comment!
Please enter your name here