Phone :  +370 (5) 204-1903
Email: sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. Installing FAMP on FreeBSD
Installing FAMP on FreeBSD


Dec, 17

FreeBSD is a Unix like operating system that has attracted popularity among people. This OS is light which makes it a great choice for hosting aims. In this tutorial we will help you install FAMP stack on FreeBSD. This stack installation helps you to make your FreeBSD as a web server. 

FAMP is an acronym that stands for FreeBSD , Apache ,MySQL ,and PHP that we will install all these options on FreeBSD OS.

Notice: In this tutorial we have used a raw FreeBSD to prevent software interference. We recommend you to use a raw OS.

Join us with Installing FAMP on FreeBSD

FAMP installation on FreeBSD

FAMP Packages Installation

Before starting installation process, issue the below commands to update your FreeBSD and make it ready to FAMP packages installation.

freebsd-update fetch

freebsd-update instal

Installing Apache

With the server up-to-date, we will install Apache web server in next step.

Install Apache 2.4 on FreeBSD

To install and update Apache 2.4, use this command:

pkg install apache24

Note: If you have not used pkg since now, it will prompt you about its installation. Press Y key to let it to install pkg then issue the above command again to start Apache installation.

Enter y at the confirmation prompt.

use the bellow command to add Apache service to startup services:

sysrc apache24_enable=yes

now restart Apache using the bellow command:

service apache24 start

You can now verify that Apache is installed correctly by typing http:// and your IP address on your browser (http://YOUR.IP.ADD.RESS ). You should see apache default page. You have installed Apache on FreeBSD now we will install MySQL in the next step.

Install MySQL on FreeBSD

First, execute the bellow command to install MySQL:

pkg install mysql56-server

During installation, it will ask you about installation confirmation. Enter y at the confirmation prompt.

use the bellow command to enable MySQL service to start automatically at system boot process:

sysrc mysql_enable=YES

Now start the MySQL server:

service mysql-server start

Now we want to configure our MySQL. Start the interactive script by running this command:

sudo mysql_secure_installation

reply the questions below one by one:

  • hit Enter to start configuration.
  • hit y to prompt for MySQL root password.
  • enter root password.
  • retype root password.
  • hit y key to remove anonymous user.
  • hit y to disable remote root logins.
  • hit y to remove test database from MySQL.
  • hit y to load these new rules.

Issue the following command to make sure that you have installed MySQL correctly and the settings you have made in the previous steps, are done properly:

mysql -u root -p

it will prompt for root password that you have created it in previous steps. hit CTRL+C key combination to exit from test.

At this point, your database system and Apache web server are installed and we can move on next step. Next step is PHP installation and configuration.

Install PHP on FreBSD

to install PHP and all its required tools, issue the bellow command:

pkg install mod_php56 php56-mysql php56-mysqli

to confirm installation, hit y key.

Before using PHP, you must configure it to work with Apache. Edit apache configuration file using bellow command:

vi /usr/local/etc/apache24/httpd.conf

Locate the DirectoryIndex line and add index.php in front of the existing index.html, so Apache reads the PHP files:

DirectoryIndex index.html

The line should look like the following:

DirectoryIndex index.php index.html

In order to add PHP handlers to Apache, add the following lines at the bottom of the configuration file:

<FilesMatch "\.php$">

    SetHandler application/x-httpd-php

<FilesMatch "\.phps$">

    SetHandler application/x-httpd-php-source

 You can now save and exit file. Press Esc key and type “:wq” to do so.

restart Apache, so all your configuration take effect:

service apache24 restart

We have installed FAMP on FreeBSD.

Test PHP functionality

To verify and test PHP functionality, you can follow below steps:

switch to /usr/local/www/apache24/data directory using below command:

cd /usr/local/www/apache24/data

create a file named info.php with the command below:

vi  info.php

Insert the following PHP code in the empty file then save and exit:

Restart the Apache HTTP service one last time so all the changes take effect:

service apache24 restart

Now open a browser and enter your server IP following with /info.php. You must see something like bellow:


Congratulations! In this article, you have learnt how to install FAMP stack on FreeBSD.

If you are facing any problem with the installation, feel free to comment here. We will help you to solve the issue.




author img


Generic placeholder image

2018 Feb 11, 20:02:47

you are actually a excellent webmaster. The web site loading velocity is incredible. It seems that you're doing any distinctive trick. Furthermore, The contents are masterpiece. you've performed a wonderful task in this topic!

Generic placeholder image

2018 Mar 31, 08:03:34

Hey Thеre. Ӏ discovered үour blog using msn. Thіs is a ѵery neatly ѡritten article. Ι will ƅe sure to bookmark іt and return to read extra οf youг helpful info. Tһanks fߋr thе post. I'll сertainly comeback.

Generic placeholder image
buy vardenafil generic

2018 Apr 02, 20:04:06

Hi there, I log on to your new stuff daily. Your writing style is witty, keep up the good work!

Generic placeholder image
реальные методы заработка в интернете без вложений

2019 Nov 13, 01:11:23

It’s amazing to visit this website and reading the views of all colleagues about this post, while I am also zealous of getting knowledge.

Leave A Comment