Apache · Apache 2.4 · BSD · FAMP · FreeBSD · FreeBSD 11 · MySQL · PHP · Web Server

Setting up FAMP server on FreeBSD 11 using Pkg

FAMP stands for “FreeBSD, Apache, MySQL and PHP”. The following procedure shows how you can install FAMP server on FreeBSD 11 using ‘pkg’ tool.


Install MySQL using the following command.

pkg install mysql57-server

Once MySQL is installed we need to set the password for root user. Start the MySQL server once for setting the password for root.

/usr/local/etc/rc.d/mysql-server onestart

Edit /etc/rc.conf and add the following line to enable MySQL service.


Restart MySQL server

/usr/local/etc/rc.d/mysql-server restart


Install Apache Web server using the following command.

pkg install apache24

Edit /etc/rc.conf and add the following line to enable Apache service.


Check if Apache service can be started without errors.

/usr/local/etc/rc.d/apache24 start

Edit the file /usr/local/etc/apache24/httpd.conf and uncomment the following line and add the registered DNS address here. If the server doesn’t have a registered DNS name, enter its IP address instead of the FQDN. If there are any additional configurations to be done, edit the appropriate lines in this file.

ServerName www.example.com:80

Restart Apache server to test.

/usr/local/etc/rc.d/apache24 restart


Install PHP and related dependencies using the following command

pkg install php56 mod_php56

Check if the reference to the PHP5 module is added to the Apache configuration file.

cat /usr/local/etc/apache24/httpd.conf | grep php5_module

The output should be similar to the following. If the output is empty, add the line, or if line is commented, uncomment it.

LoadModule php5_module libexec/apache24/libphp5.so

Edit the file /usr/local/etc/apache24/httpd.conf and make the following changes

DirectoryIndex index.php

        DirectoryIndex index.php index.html
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps

Restart Apache service once the changes are made.

/usr/local/etc/rc.d/apache24 restart

Create a new file /usr/local/www/apache24/data/info.php and add the following lines to check the installation.

<!--?php phpinfo(); phpinfo(INFO_MODULES); ?--><!--?php phpinfo(); phpinfo(INFO_MODULES); ?-->

Use the following URL to load the web page.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s